ReplacableToken_ when using web.config transform?

Web Config

Web Config Problem Overview


I have a web.config with 2 transforms - for debug and release.

web.config:

<connectionStrings>
	<clear />
	<add name="StrName" connectionString="data source=.\sqlexpress;User Id=sa;Password=pass;Database=SocialBot;"
				providerName="System.Data.SqlClient" />
</connectionStrings>

I just copied the example given and replaced the name with StrName. I end up with :

<add name="StrName" connectionString="$(ReplacableToken_SocialBotConnectionString-Web.config Connection String_0)"
				providerName="System.Data.SqlClient" />

What the hell is ReplacableToken_ ?

I have another project and it works with no problem there.

Web Config Solutions


Solution 1 - Web Config

If, like me, you're running up against this problem while trying to automate your build process using msbuild from the command line, the correct answer can be found in this blog entry:

http://www.zvolkov.com/clog/2010/05/18/how-to-packagepublish-web-site-project-using-vs2010-and-msbuild/

Specifically, the parameter you need to set is:

/p:AutoParameterizationWebConfigConnectionStrings=False

This is most likely what VS is doing on your behalf when you publish to the filesystem

Solution 2 - Web Config

If you want to build with Visual Studio 2010, add the following line to your configuration PropertyGroup in your .csproj:

<AutoParameterizationWebConfigConnectionStrings>False</AutoParameterizationWebConfigConnectionStrings>

More details here: https://stackoverflow.com/questions/7207689/how-to-get-rid-of-replacabletoken-in-web-config-conpletely/7586546#7586546

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsirroccoView Question on Stackoverflow
Solution 1 - Web ConfigIain HunterView Answer on Stackoverflow
Solution 2 - Web ConfigAndre AlbuquerqueView Answer on Stackoverflow