CZEMacLeod / MSBuild.SDK.SystemWeb

This MSBuild SDK is designed to allow for the easy creation and use of SDK (shortform) projects targeting ASP.NET 4.x using System.Web.
MIT License
151 stars 8 forks source link

Default Template fails on Azure Pipelines and Github Actions with msBuild #17

Closed Zonorai closed 3 years ago

Zonorai commented 3 years ago

Repro: repo: https://github.com/Zonorai/MSBuild.SDK.SystemWeb.AzureDeployment repro: https://github.com/Zonorai/MSBuild.SDK.SystemWeb.AzureDeployment/runs/2637811182?check_suite_focus=true

CZEMacLeod commented 3 years ago

It looks like this is from the change https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb/commit/9c7519e027b459641aaa4e55bbedd9a35fcac452 This automatically includes web.config and the related web.$(Configuration).config files into the project. It also includes any publish profile transforms too. This was added with the SDK version 4.0.34, and the templates are still referring to version 4.0.33. This is why it worked when I did my test. The templates weren't updated to remove these files. You can actually simply fail the build on the command line with

msbuild msSdk.sln /t:Publish /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingeFile=true /p:PackageLocation="./artifacts"

Commenting out

<Content Include="Web.config" />

Will allow it to build and publish. You shouldn't need

    <Content Include="Web.Debug.config">
      <DependentUpon>Web.config</DependentUpon>
    </Content>
    <Content Include="Web.Release.config">
      <DependentUpon>Web.config</DependentUpon>
    </Content>

either. These should be of type None and not included in the published files as they are configuration transforms. If you have publish transforms, those will be automatically included as Content now so you can omit them from the project file too.