一键式发布vs 2012:如何删除_ConnectionStringsToInsert? [英] One-click publish in vs 2012: how to remove _ConnectionStringsToInsert?

查看:94
本文介绍了一键式发布vs 2012:如何删除_ConnectionStringsToInsert?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通常将连接字符串放在一个单独的文件中,在web.config中添加如下内容:

I usually put my connection string to a separate file, adding something like this in web.config:

<connectionStrings configSource="WebConnection.config" />

我刚刚安装了VS 2012,它会自动获取我现有的发布设置. 但是,当我进行网络发布时,现在它自己添加了两个连接字符串,因此部署目标上的web.config现在看起来像这样:

I've just installed VS 2012 and it automatically picked up my existing publish settings. However, when I do a webpublish it now adds two connections strings by itself, so my web.config on the deployment target now looks like that:

  <connectionStrings configSource="WebConnection.config">
    <add name="EF.Model.DbContext" connectionString="EF.Model.DbContext_ConnectionString" providerName="System.Data.SqlClient" />
    <add name="Migrations.Db.MigrationDb" connectionString="Migrations.Db.MigrationDb_ConnectionString" providerName="System.Data.SqlClient" />
  </connectionStrings>

肯定会产生错误(使用configSource时,节点内容必须为空). 我注意到,在新生成的.pubxml文件(现在已存储发布设置)中,有以下几行:

certainly, that produces an error (node contents must be empty when using configSource). I noticed, that in newly generated .pubxml files (where publish settings are now stored) there are following lines:

  <ItemGroup>
    <_ConnectionStringsToInsert Include="EF.Model.DbContext" />
    <_ConnectionStringsToInsert Include="Migrations.Db.MigrationDb" />
  </ItemGroup>

如何删除它们? :)如果我从文件中删除它们,则在我编辑发布设置时,Web发布对话框都会添加它们.

How can I remove them? :) If I delete them from file, Web-publish dialog adds them anytime I edit the publish settings.

推荐答案

我突然解决了这一问题,方法是转到项目属性打包/发布Web"并选中包括在P/P SQL选项卡中配置的所有数据库"标记(而且我那里没有配置任何数据库:)).

I suddenly resolved that by going to project properties, "Package/Publish Web" and checking the mark "Include all databases configured in P/P SQL tab" (and I don't have any DB configured there :)).

这样做并从.pubxml中删除上述行后,一切正常.

After doing this and deleting the mentioned lines from .pubxml everything went fine.

好像是黑客,但这对我来说是一种方法:)

Seems like a hack, but it was a way to go for me :)

@说,感谢您确认这是一个错误,希望它会得到解决!

@Sayed, thanks for confirming it's a bug, hope it'll be resolved!

这篇关于一键式发布vs 2012:如何删除_ConnectionStringsToInsert?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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