使用 web.config 转换时的 ReplaceableToken

编程入门 行业动态 更新时间:2024-10-26 03:25:17
本文介绍了使用 web.config 转换时的 ReplaceableToken_?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我有一个带有 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/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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 16:37:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1139252.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:web   config   ReplaceableToken

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!