97

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.

2 Answers 2

163

If, like me, you're running up against this problem while trying to automate your build process using msbuild from the command line. 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

Sign up to request clarification or add additional context in comments.

Comments

34

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: How to get rid of "$(ReplacableToken...)" in web.config completely

1 Comment

+1 This is what allows you to click "Build Deployment Package" to get the transformed web.config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.