Webdeploy - 预编译 asp.net 应用程序错误,在排除的 app_data 文件夹中排除了连接字符串

Webdeploy - precompile asp.net application error with excluded connectionstrings in excluded app_data folder

我尝试将 webdeploy 用于我们的 asp.net 应用程序。今天我尝试激活 "Precompile during publishing" 标志。似乎这个标志不能与 "Exclude files from the App_Data folder".

一起使用

在我激活 webdeploy 中的预编译之前一切正常。如果我从我的 connectionStrings 和 运行 中删除 configSource 并预编译它的 webdeploy 它再次工作。

问题是我必须加载外部连接字符串文件,因为它将由生产环境的管理员管理。

我从 webdeploy 得到的错误信息是:

"An error occurred loading a configuration file: Directory 'C:\MyProject\obj\Release\AspnetCompileMerge\Source\App_Data' does not exist. Failed to start monitoring file changes."

我当前的设置如下: Web.Config:

<configuration>
  <!-- Section stuff here -->
  <connectionStrings configSource="App_Data\DBConnection.xml" />
  <!-- More stuff here -->
</configuration>

新的网络部署设置:

通过将以下 MSBuild 脚本添加到您的项目文件或 wpp.targets 文件中,尝试从包中排除配置文件:

<ItemGroup>  
  <ExcludeFromPackageFiles Include="App_Data\DBConnection.xml">  
    <FromTarget>Project</FromTarget> 
  </ExcludeFromPackageFiles> 
</ItemGroup> 

嘿,这对我们不起作用。但我们也在最近几天更新了我们的 tfs,我们查看了 webdeploy 参数,可以使用新 tfs 的发布管理器轻松设置这些参数。所以我们只是将连接字符串重新添加到 web.config 中,然后编译所有内容。最后,我们决定了它的部署位置,然后我们自动设置了对我们开发人员隐藏的连接字符串。