web.config file to generate and not generate in the ms build arguments

43 Views Asked by At

I have a requirement in my project that i need to do some modification in the web.config file in the flag to generate and not generate web.config file depending on the new parameter

I am getting the below error and please find my condition in the code which I made in yaml file.

error:The directive 'if' is not allowed in this context. Directives are not supported for expressions that are embedded within a string. Directives are only supported when the entire value is an expression.

Code:

  • name: 'suppressWebConfig' type: boolean default: true
inputs:
msbuildArgs: ${{ if eq(parameters.suppressWebConfig, true) }}'/p:DeployOnBuild=true
 /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true 
 /p:MarkWebConfigAssistFilesAsExclude=false /p:IsTransformWebConfigDisabled=true /p:TransformWebConfigEnabled=false 
 /p:ProfileTransformWebConfigEnabled=false
 /p:PackageLocation="$(build.artifactstagingdirectory)\\"'${{ else }}'/p:DeployOnBuild=true 
 /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true
 /p:PackageLocation="$(build.artifactstagingdirectory)\\"'${{ end }}
      platform: 'Any CPU'

Please guide me what needs to add in the code

we tried to put condition in the steps.

0

There are 0 best solutions below