Closed stevenvolckaert closed 1 year ago
Hi @stevenvolckaert
This is a known issue with the current SDK.
Publish only includes content if the DependentUpon
field is not set (so it is not nested in the UI).
The SDK already includes non-configuration web.*.config
files as content, but it nests them.
The 'problem' is here: https://github.com/CZEMacLeod/MSBuild.SDK.SystemWeb/blob/afc4c08d291166886f39ff4ebfd04961acf28944/src/MSBuild.SDK.SystemWeb/Sdk/MSBuild.SDK.SystemWeb.DefaultItems.props#L19
Add the following to your project file and it should resolve the issue.
<ItemGroup>
<Content Update="Web.*.config">
<DependentUpon></DependentUpon>
</Content>
</ItemGroup>
I think that the nesting can be done a different way - perhaps a virtual publishing node and some custom display xaml - but that is not something I am very familiar with (yet).
Hi @CZEMacLeod! Thank you for your answer.
I confirm adding <Content Update="Web.*.config" DependentUpon="" />
worked; the files are now part of package when publishing.
I'll close this issue as you mentioned it is a known issue, so this issue is probably a duplicate.
I'm using MSBuild.SDK.SystemWeb version 4.0.79 in one of our ASP.NET applications, where I have included some environment-specific Web.config files, which contain XDT transforms:
They are in the csproj file as follows:
I'm using an Azure DevOps pipeline to build and publish the project with MSBuild. The publish task is using the WebPublish MSBuild target:
For some reason, the files Web.Release.Development.config and Web.Release.Staging.config do not end up in the output directory of the WebPublish MSBuild target; so they also do not appear in the build artifact.
Does anyone have an idea why this is?
This is not urgent, as I've worked around this issue by renaming the files to
*.config.xml
.Thanks for looking into this!