neu*_*t47 6 c# asp.net asp.net-mvc
我的ASP.NET MVC项目有三个发布配置文件.
我需要为所有这些添加转换.为此,我在web.config文件中选择了"添加配置转换"并获得了4个Web配置:
但是我无法理解如何将它们中的任何一个分配给任何发布配置文件.例如,我找不到用于开发发布配置文件的put转换的正确配置文件.我怎样才能做到这一点 ?谢谢你的建议.
我创建了一个新的网络配置,我命名为“Web.development.config”。这是我用于转换的项目文件代码:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="AfterCompile" Condition="exists('Web.$(Configuration).config')">
<!-- Generate transformed app config in the intermediate directory -->
<TransformXml Source="Web.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="Web.$(Configuration).config" />
<!-- Force build process to use the transformed configuration file from now on. -->
<ItemGroup>
<AppConfigWithTargetPath Remove="Web.config" />
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
</Target>
Run Code Online (Sandbox Code Playgroud)
因此,使用此解决方案,您可以使用 Web.<your publish profile name>.config
| 归档时间: |
|
| 查看次数: |
3188 次 |
| 最近记录: |