我和我的团队正在将 VS2012 用于许多项目,并与我们的 QA 和 UAT 小组一起开发了一个工作流程,其中涉及 5 个环境:本地、开发阶段、测试、预生产和生产。我们发现自己必须为每个项目和解决方案创建 Local/Dev/Test/Preprod/Prod 构建配置,并删除调试和发布配置。
有没有办法让 VS 在新项目上默认创建这些环境而不是调试/发布配置?
编辑:
我无法为此找到任何全局选项,因为构建配置似乎都在各个项目文件夹中。
我所做的是找到一些我最常见的项目并因此修改了项目模板:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Local|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<-- SNIP -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Prod|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Content Include="Web.config" />
<Content Include="Web.Local.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Dev.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Test.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Preprod.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Prod.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
当我创建新项目时,我想要的所有环境都在那里,调试也没有了!但是,Release 仍然存在,包括我删除的 web.Release.Config 文件。知道这个无关的配置文件/构建配置可能来自哪里吗?
最佳答案
是的,创建一个 custom project template .如果这还不够,您甚至可以创建一个 custom project type ,然而,这有点复杂。
关于visual-studio - 将默认构建配置添加到 Visual Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17371404/