使用 web.config 转换时的 ReplaceableToken_? [英] ReplacableToken_ when using web.config transform?

查看:23
本文介绍了使用 web.config 转换时的 ReplaceableToken_?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 2 个转换的 web.config - 用于调试和发布.

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

web.config:

web.config:

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

我只是复制了给出的示例并将名称替换为 StrName.我最终得到:

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" />

ReplacableToken_ 到底是什么?

What the hell is ReplacableToken_ ?

我有另一个项目,它在那里没有问题.

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

推荐答案

如果您和我一样,在尝试从命令行使用 msbuild 自动化构建过程时遇到了这个问题,可以找到正确的答案在此博客条目中:

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

当您发布到文件系统时,这很可能是 VS 代表您所做的

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

这篇关于使用 web.config 转换时的 ReplaceableToken_?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆