Removing ConnectionString when deploying with Visual Studio 2012

北慕城南 提交于 2020-01-01 12:11:18

问题


I'm working on a project with 2 web applications, one being hosted as long running process (with appfabric), the other is just a normal MVC application. They share same datacontext, thus same connectionString. The appfabric application is deployed as a child application of the main, taking advantage of the web.config inheritance (we don't want connectionstring to be duplicated in web config)

My problem is that with the new Visual Studio 2012 wizard for publishing, the connectionString are automatically added, even when I untick the "Use this connection string at runtime" box.

I also try to use web config transform like this:

  <connectionStrings>
      <add xdt:Transform="RemoveAll" />
  </connectionStrings>

But connection string are still on my web config after publishing.

Any suggestions ? I'm thinking about removing completely the web config for that child application but it's not ideal.


回答1:


answer can be found here: Web Deploy / Publish is adding a unknown connection string?

Add this project property to the .csproj file by editing the XML:

<Project>
    <PropertyGroup>

         <AutoParameterizationWebConfigConnectionStrings>false</AutoParameterizationWebConfigConnectionStrings>

   ...
    </PropertyGroup>
...
</Project>


来源:https://stackoverflow.com/questions/14865379/removing-connectionstring-when-deploying-with-visual-studio-2012

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!