Build ToolsContinuous IntegrationDevOpsJenkinsMSBuild

Error MSB4113: Specified condition Auto Parameterization Web Config Connection Strings

We have setup an automated build process for .NET applications in Jenkins CI tool using MSBuild. One application encountered an issue at compile time but the same application was working fine when build locally using Visual Studio.

Error Log:

Example 1: The Boolean condition is False

Error MSB4113: Specified condition "$(AutoParameterizationWebConfigConnectionStrings)" evaluates to " False " instead of a boolean

or

Example 2: The Boolean condition is True

Error MSB4113: Specified condition "$(AutoParameterizationWebConfigConnectionStrings)" evaluates to " True" instead of a boolean

Solution:

Microsoft is using auto parameterization by default which also applies to connectionstrings. To disable/enable the same, below declaration was added in csproj file of the project which was giving error at build time.

Example 1:

<AutoParameterizationWebConfigConnectionStrings>
False
</AutoParameterizationWebConfigConnectionStrings>

or

Example 2:

<AutoParameterizationWebConfigConnectionStrings>
True
</AutoParameterizationWebConfigConnectionStrings>

If you notice, the error itself provides the reason which is nothing but space between first and last character of True  or False Boolean value i.e. [space]True[space] or [space]False[space] in the above code. Hence, it can not be considered as Boolean string.

To resolve the problem, the declaration should be updated into single line without any spaces as follows:

Example 1:

<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>

or

Example 2:

<AutoParameterizationWebConfigConnectionStrings>True</AutoParameterizationWebConfigConnectionStrings>

Do let us know if this solution works for you by using the comment section.

Related Articles

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button