我尝试通过 Visual Studio 将应用程序发布到 Azure,但不断收到以下错误:
Severity Code Description Project File Line Error Publish Database Setting Source Verification Error: The connection 'DBConnection' in the publish profile has changed from what is currently declared for 'DBConnection (path_to_my_web.config)'. Because of this publishing has been blocked. If this was intended you can disable this check by specifying the value of "True" for the MSBuild property "IgnoreDatabaseSettingOutOfSync." If this was not intended, open the Publish dialog in Visual Studio with this profile to correct the discrepancy. For more information visit http://go.microsoft.com/fwlink/?LinkId=241526 PhotographyAPI 0
在哪里可以通过为 MSBuild 属性“IgnoreDatabaseSettingOutOfSync”指定“True”值来禁用此检查?
我在哪里设置这个属性?
最佳答案
您需要手动编辑 .csproj
文件来设置 Visual Studio 没有 UI 的各个 MSBuild 属性。通常在文件顶部附近应该有一个 <PropertyGroup>
没有 Condition
的元素属性。该组指定将应用于所有配置(如调试、发布等)的属性。然后您可以将该属性添加到该组中:
<PropertyGroup>
<IgnoreDatabaseSettingOutOfSync>True</IgnoreDatabaseSettingOutOfSync>
</PropertyGroup>
(当然,您可以添加一个额外的 PropertyGroup
,只需确保在引用 <Import>
文件的 .targets
元素之前执行此操作)。
请注意,这将抑制错误,但更改的数据库设置在部署期间可能仍然存在危险。 (这就是错误存在的原因)
关于c# - 我在哪里可以获得 'IgnoreDatabaseOutOfSync' 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45804014/