-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Issue Description
Problem encountered in MudBlazor/MudBlazor#5801
<Target Name="IncludeGeneratedStaticFiles" DependsOnTargets="WebCompiler" BeforeTargets="BeforeBuild">
<ItemGroup>
<!--Include without duplication-->
<_NewCompiledDocsCssFiles Include="wwwroot/MudBlazorDocs.min.css" Exclude="@(Content)" />
<Content Include="@(_NewCompiledDocsCssFiles)" />
</ItemGroup>
</Target>
It seems Include="wwwroot/MudBlazorDocs.min.css" pattern with Exclude=@(Content) fails to remove duplicates on windows. I need to use \ (backslash) for path separator in order for it to work on Windows and Linux/mac
In all our project files we normally use / (forward slash) for path separators and the problem didn't show up on mac or build servers (Linux).
However windows users local builds started to fail.
In the following example wwwroot/MudBlazorDocs.min.css as the Include pattern fails on Windows platform with duplicate content files.
If I change it to wwwroot\MudBlazorDocs.min.css the Content is correct and the build succeeds with no duplicate Content files
Steps to Reproduce
Repo
Build MudBlazor/MudBlazor#5801 on Windows (fails)
Build MudBlazor/MudBlazor#5801 on OS with / path separator (succeeds)
Alternatively use HEAD of dev and change the following lines to a forward slash the build will fail on windows but succeed on Linux/mac
https://github.com/MudBlazor/MudBlazor/blob/2f65df6b8d39ddd7109bce58648ad60be606f177/src/MudBlazor/MudBlazor.csproj#L91
https://github.com/MudBlazor/MudBlazor/blob/2f65df6b8d39ddd7109bce58648ad60be606f177/src/MudBlazor/MudBlazor.csproj#L92
https://github.com/MudBlazor/MudBlazor/blob/2f65df6b8d39ddd7109bce58648ad60be606f177/src/MudBlazor.Docs/MudBlazor.Docs.csproj#L113
Expected Behavior
To be able to use / everywhere as the path separator for Xplat builds
Actual Behavior
The Include Exclude pair fails and duplicate files are passed to Microsoft.NET.Sdk.Razor.StaticWebAssets
C:\Program Files\dotnet\sdk\7.0.100\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.target s(419,5): error : Two assets found targeting the same path with incompatible asset kinds:
Analysis
Something to do with path separators and string comparisons only when using forward slash as path separator
Seems similar to #724
However that looks like it had a fix
Versions & Configurations
dotnet msbuild --version
MSBuild version 17.4.0+18d5aef85 for .NET
17.4.0.51802
- If applicable, include the version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
dotnet --version
7.0.100