Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 如何使用.NET Web部署项目删除Web.config节_Asp.net_Azure_Web Config_Web Deployment - Fatal编程技术网

Asp.net 如何使用.NET Web部署项目删除Web.config节

Asp.net 如何使用.NET Web部署项目删除Web.config节,asp.net,azure,web-config,web-deployment,Asp.net,Azure,Web Config,Web Deployment,我使用Web部署项目构建发布包并替换Web.config文件的特定部分。我使用用于调试的值配置原始web.config文件,例如AppSettings。然后我有一个名为AppSettings.Release.config的文件,我使用以下内容构建发布包: <ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> <WebConfigReplacementFiles Include

我使用Web部署项目构建发布包并替换Web.config文件的特定部分。我使用用于调试的值配置原始web.config文件,例如AppSettings。然后我有一个名为AppSettings.Release.config的文件,我使用以下内容构建发布包:

<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
    <WebConfigReplacementFiles Include="Config\AppSettings.Release.config">
        <Section>appSettings</Section>
    </WebConfigReplacementFiles>
    <WebConfigReplacementFiles Include="Config\Compilation.Release.config">
        <Section>system.web/compilation</Section>
    </WebConfigReplacementFiles>
    <WebConfigReplacementFiles Include="Config\CustomErrors.Release.config">
        <Section>system.web/customErrors</Section>
    </WebConfigReplacementFiles>
</ItemGroup>

应用程序设置
system.web/编译
system.web/customErrors
我还为调试指定了一个连接字符串,如下所示:

<connectionStrings>
    <add name="SQLConnectionString"
         connectionString="Server=[server name]Database=[database name];Integrated Security=SSPI;" />
</connectionStrings>

我正在迁移到Windows Azure,我想使用门户界面来管理我的连接字符串,而不是web.config文件。因此,在门户中,我在名为“SQLConnectionString”的连接字符串下为我的网站添加了一个条目,并使用了正确的生产字符串

我的问题是,我想使用部署项目从web.config文件中完全删除
元素。我该怎么做

注意:我试图简单地用一个空元素替换节,但得到了以下错误:

web.config(25):错误WDP00001:“web.config”中的节ConnectionString有1个元素,但“config\ConnectionString.Release.config”有0个元素


谢谢

我想知道你有没有检查过官员。以及您是否在connectionstrings.release.config中尝试了以下操作:

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


根据文档,这必须删除所有条目。

我没有使用web.config转换。我在Web部署项目中使用另一种方法。XML转换是通过自动合并多个web.config文件来完成的。我不熟悉您所说的内容,或者如果没有适当的参考,我无法理解它。但我相信,如果你在你使用的方法的文档中深入挖掘,你会发现类似的东西!