Web 配置转换失败

问题描述 投票:0回答:2
asp.net .net msbuild web.config-transform
2个回答
1
投票

当项目迁移到 SDK 样式,同时保留显式内容项时,就会发生这种情况。

修复:添加

<EnableWebFormsDefaultItems>false</EnableWebFormsDefaultItems>
或删除显式项目。

原答案复制自: https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb/issues/60


0
投票

最后我们对 CSPROJ 文件本身有些混乱......对我们有用的是:

<ItemGroup>
    <None Include="Web.Debug.config">
      <IsTransformFile>true</IsTransformFile>
      <DependentUpon>Web.config</DependentUpon>
      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
    </None>
    <None Include="Web.Release.config">
      <IsTransformFile>true</IsTransformFile>
      <DependentUpon>Web.config</DependentUpon>
      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
    </None>
    <None Include="Web.Test.config">
      <IsTransformFile>true</IsTransformFile>
      <DependentUpon>Web.config</DependentUpon>
      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
    </None>
</ItemGroup>
 .....
<ItemGroup>    
    <Content Update="Web.config">
        <CopyToOutputDirectory>Never</CopyToOutputDirectory>
        <TransformOnBuild>true</TransformOnBuild>
    </Content>
    <Content Update="Web.Debug.config">
        <IsTransformFile>true</IsTransformFile>
        <DependentUpon>Web.config</DependentUpon>
        <CopyToOutputDirectory>Never</CopyToOutputDirectory>
    </Content>
    <Content Update="Web.Release.config">
        <IsTransformFile>true</IsTransformFile>
        <DependentUpon>Web.config</DependentUpon>
        <CopyToOutputDirectory>Never</CopyToOutputDirectory>
    </Content>
</ItemGroup>
© www.soinside.com 2019 - 2024. All rights reserved.