Skip to content

Adding compression directives to a csproj breaks a Linux build with DN8P4 #48353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
MarkStega opened this issue May 21, 2023 · 1 comment
Closed
1 task done
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@MarkStega
Copy link

MarkStega commented May 21, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have added the following to the csproj of a dll included in the fsailing project:

	<!--Compression directives (Note that the patterns are relative to wwwroot)-->
	<PropertyGroup>
		<CompressionIncludePatterns>$(CompressionIncludePatterns);**/*.css;**/*.js</CompressionIncludePatterns>
		<BuildCompressionFormats>gzip;brotli</BuildCompressionFormats>
		<PublishCompressionFormats>gzip;brotli</PublishCompressionFormats>
	</PropertyGroup>

This was in response to #48308

My build works locally in Visual Studio on Windows

The build step running under ubuntu-latest fails with:

  Optimizing assemblies for size. This process might take a while.
/usr/share/dotnet/sdk/8.0.100-preview.4.23260.5/Sdks/Microsoft.NET.Sdk.StaticWebAssets/targets/Microsoft.NET.Sdk.StaticWebAssets.targets(467,5): error : Conflicting assets with the same target path '_content/Material.Blazor/material.blazor.min.js.br'. For 'All' assets 'Identity: /home/runner/work/ICEBG/ICEBG/.artifacts/obj/ICEBG.Client/azure/compressed/0akv76uegq.br, SourceType: Package, SourceId: Material.Blazor, ContentRoot: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/, BasePath: _content/Material.Blazor, RelativePath: material.blazor.min.js.br, AssetKind: All, AssetMode: All, AssetRole: Alternative, RelatedAsset: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/material.blazor.min.js, AssetTraitName: Content-Encoding, AssetTraitValue: br, CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/material.blazor.min.js' and 'Identity: /home/runner/work/ICEBG/ICEBG/.artifacts/obj/ICEBG.Client/azure/compressed/publish/0akv76uegq.br, SourceType: Package, SourceId: Material.Blazor, ContentRoot: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/, BasePath: _content/Material.Blazor, RelativePath: material.blazor.min.js.br, AssetKind: All, AssetMode: All, AssetRole: Alternative, RelatedAsset: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/material.blazor.min.js, AssetTraitName: Content-Encoding, AssetTraitValue: br, CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/material.blazor.min.js'. [/home/runner/work/ICEBG/ICEBG/ICEBG.Client/ICEBG.Client.csproj]
/usr/share/dotnet/sdk/8.0.100-preview.4.23260.5/Sdks/Microsoft.NET.Sdk.StaticWebAssets/targets/Microsoft.NET.Sdk.StaticWebAssets.targets(467,5): error : Conflicting assets with the same target path '_content/Material.Blazor/material.blazor.min.js.br'. For 'All' assets 'Identity: /home/runner/work/ICEBG/ICEBG/.artifacts/obj/ICEBG.Client/azure/compressed/0akv76uegq.br, SourceType: Package, SourceId: Material.Blazor, ContentRoot: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/, BasePath: _content/Material.Blazor, RelativePath: material.blazor.min.js.br, AssetKind: All, AssetMode: All, AssetRole: Alternative, RelatedAsset: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/material.blazor.min.js, AssetTraitName: Content-Encoding, AssetTraitValue: br, CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/material.blazor.min.js' and 'Identity: /home/runner/work/ICEBG/ICEBG/.artifacts/obj/ICEBG.Client/azure/compressed/publish/0akv76uegq.br, SourceType: Package, SourceId: Material.Blazor, ContentRoot: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/, BasePath: _content/Material.Blazor, RelativePath: material.blazor.min.js.br, AssetKind: All, AssetMode: All, AssetRole: Alternative, RelatedAsset: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/material.blazor.min.js, AssetTraitName: Content-Encoding, AssetTraitValue: br, CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: /home/runner/.nuget/packages/material.blazor/4.0.0-preview.18/staticwebassets/material.blazor.min.js'. [/home/runner/work/ICEBG/ICEBG/ICEBG.Client/ICEBG.Client.csproj]
Error: Process completed with exit code 1.

Expected Behavior

I expect the build to complete even with compression of assets enabled

Steps To Reproduce

The repository is at

https://github.com/MarkStega/ICEBG branch vNext2

The build step that is failing is:

      run: |
        dotnet publish ICEBG.Web.DataServices/ICEBG.Web.DataServices.csproj --os linux --arch x64 --configuration Azure -p:PublishProfile=DefaultContainer -p:Version=${{ env.suffix }} -p:ContainerImageName=${{env.appNameDS}}
        docker tag ${{env.appNameDS}}:${{ env.suffix }} ${{ secrets.REGISTRY_LOGIN_SERVER }}/${{env.appNameDS}}:${{ env.suffix }}
        docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/${{env.appNameDS}}:${{ env.suffix }}

It is failing at the first bit, the dotnet publish

If I remove the compression directives the publish succeeds.

Failing workflow run: https://github.com/MarkStega/ICEBG/actions/runs/5037755647/jobs/9034796487

Successful workflow run: https://github.com/MarkStega/ICEBG/actions/runs/5037901742

Exceptions (if any)

No response

.NET Version

This is the DN8 Preview 4

Anything else?

[EDIT] This is not a github action issue. The same error occurs in a docker build with the following environment:

FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview AS base
RUN dotnet --info

WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:8.0-preview AS build
RUN dotnet --info

ARG version=2022-01-01--13-00-00--WIP

ENV DEBIAN_FRONTEND noninteractive
ENV DEBCONF_NOWARNINGS="yes"
RUN apt-get update
RUN apt-get install --no-install-recommends --yes apt-utils python3 npm
RUN dotnet --info
RUN dotnet workload install wasm-tools

RUN node --version
RUN npm --version
ENV NODE_VERSION=19.0.1
RUN apt install -y curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
ENV NVM_DIR=/root/.nvm
RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm use v${NODE_VERSION}
RUN . "$NVM_DIR/nvm.sh" && nvm alias default v${NODE_VERSION}
ENV PATH="/root/.nvm/versions/node/v${NODE_VERSION}/bin/:${PATH}"
RUN node --version
RUN npm --version

WORKDIR /src

COPY ["Website.Server/Website.Server.csproj", "Website.Server/"]
COPY ["./Directory.Build.props", "Website.Server/"]
COPY ["Website.Server/NuGet.Config", "Website.Server/"]

COPY ["Website.Client/Website.Client.csproj", "Website.Client/"]
COPY ["./Directory.Build.props", "Website.Client/"]

COPY ["Website.WebAssembly/Website.WebAssembly.csproj", "Website.WebAssembly/"]
COPY ["./Directory.Build.props", "Website.WebAssembly/"]

RUN dotnet restore --disable-parallel "Website.Server/Website.Server.csproj"
COPY . .
WORKDIR "/src/Website.Server"
RUN dotnet publish "Website.Server.csproj" -c Release_Server -o /app/publish -p:Version=$version

FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "Website.Server.dll"]
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label May 21, 2023
@MackinnonBuck
Copy link
Member

Thanks for the issue report, @MarkStega. This was just resolved in dotnet/sdk#32700.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

2 participants