Web.config转换选项显示为灰色

Not*_*tMe 61 vb.net web-config visual-studio-2010 visual-studio

在VS2010中,当我右键单击我的web.config文件时,"Add Config Transforms"选项显示为灰色.

知道我怎么能回来的?

Not*_*tMe 83

它是灰色的,因为已经有所有列出的配置的转换.

我看不到改变的文件,因为vb.net在其无穷的智慧决定不在本地显示相关的配置文件.显然,除了选择"显示所有文件"以便查看它们别无选择.

  • C#做同样的事情 (4认同)
  • 我喜欢vb.net的无限智慧 (3认同)
  • @TomStickel:实际上,c#在web.config文件名旁边添加了小+号.VB没有. (2认同)

Mar*_*ter 13

还可以完全避免配置管理器对话框,只需直接编辑项目文件,根据需要添加任意数量的附加配置文件.

当使用CodeAssassin.ConfigTransform或SlowCheetah等更高级的配置转换工具时,这尤其有用.

<ItemGroup>
    <Content Include="web.config">
        <SubType>Designer</SubType>
    </Content>
    <Content Include="web.debug.local.config">
        <DependentUpon>web.config</DependentUpon>
    </Content>
    <Content Include="web.debug.cloudstaging.config">
        <DependentUpon>web.config</DependentUpon>
    </Content>
    <Content Include="web.release.cloudprod.config">
        <DependentUpon>web.config</DependentUpon>
    </Content>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)


小智 8

如果要真正看到"添加配置转换",请使用configurationManager添加新配置.或者删除任何配置文件web.release.config或web.Debug.config.这是Visual Studio限制,以便为每个环境提供单个配置文件.


小智 5

对我有用的是右键单击发布配置文件并选择“添加配置转换”,然后我复制了我们用于 QA、UAT、生产等转换的现有代码。