Skip to content
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

Microsoft.NET.Sdk.Razor GeneratePackageOnBuild creating folders for random static web assets #29561

Closed
groogiam opened this issue Jan 23, 2021 · 3 comments · Fixed by dotnet/sdk#19873
Assignees
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-static-web-assets investigate severity-major This label is used by an internal tool
Milestone

Comments

@groogiam
Copy link

Describe the bug

When generating a nuget package for a blazor class library random files are created as directories. See attached repro.

To Reproduce

  1. Open the attached repro Blazor5ClassLib.zip
  2. Build the project
  3. Navigate to bin\Debug\
  4. Extract the contents of Blazor5ClassLib.1.0.0.nupkg
  5. Navigate to Blazor5ClassLib.1.0.0\staticwebassets\css\open-iconic
  6. The FONT-LICENSE and ICON-LICENSE files have been packaged as a directory rather than the static file in the project. This causes blazor wasm publishes which reference this package to fail with an error similar to Blazor - BrotliCompress msbuild task duplicate processing of files - causes lock exceptions #29529
staticwebassets\css\open-iconic\ICON-LICENSE' is denied.
            at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
            at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
            at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
            at System.IO.File.OpenRead(String path)
            at Microsoft.NET.Sdk.BlazorWebAssembly.Tools.BrotliCompressCommand.<ExecuteCoreAsync>b__16_0(Int32 i)
            at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
         --- End of stack trace from previous location ---
            at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
            at System.Threading.Tasks.TaskReplicator.Replica`1.ExecuteAction(Boolean& yieldedBeforeCompletion)
            at System.Threading.Tasks.TaskReplicator.Replica.Execute()

Static assets should be packaged as they are in the project.

Exceptions (if any)

Further technical details

  • ASP.NET Core version
  • Include the output of dotnet --info
    Runtime Environment:
    OS Name: Windows
    OS Version: 10.0.19042
    OS Platform: Windows
    RID: win10-x64
    Base Path: C:\Program Files\dotnet\sdk\5.0.102\

Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96

.NET SDKs installed:
5.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
  • Visual Studio 16.8.4
@groogiam groogiam changed the title GeneratePackageOnBuild creating folders for random static web assets Microsoft.NET.Sdk.Razor BlazorGeneratePackageOnBuild creating folders for random static web assets Jan 23, 2021
@groogiam
Copy link
Author

I have done some more experimentation and the issue seems to persist if I rename the two license files to have a .txt suffix. If I delete them both or combine them into a single text file with a different name the publish seems to work. The behavior is extremely strange.

@groogiam groogiam changed the title Microsoft.NET.Sdk.Razor BlazorGeneratePackageOnBuild creating folders for random static web assets Microsoft.NET.Sdk.Razor GeneratePackageOnBuild creating folders for random static web assets Jan 23, 2021
@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone Jan 25, 2021
@ghost
Copy link

ghost commented Jan 25, 2021

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@SteveSandersonMS SteveSandersonMS added affected-few This issue impacts only small number of customers bug This issue describes a behavior which is not expected - a bug. severity-major This label is used by an internal tool labels Jan 26, 2021 — with ASP.NET Core Issue Ranking
@javiercn
Copy link
Member

It's somewhat of a fuzzy area where the bug can be attributed to Nuget. We are specifying the path in the package and nuget is deciding to create the additional folder.

That said, it's not clear to me if PackagePath is meant to represent the file path, the folder path, or potentially both, so we can fix it on our end by adjusting the PackagePath

javiercn added a commit to dotnet/sdk that referenced this issue Aug 20, 2021
* Fixes an issue with projects not working with reference assemblies
  using HintPath.
* Fixes an issue where files without an extension where being included
  inside an additional folder with the file name on nuget packages.
* Adds additional error logging for the brotli compression tool.
* Adds additional login for the gzip compress task.
* Adds editor config files in the blazor wasm and razor sdk folders
  to handle 'var' usage preferences in ASP.NET Core projects.
* Performs a more selective filtering for static web assets candidates
  from the build candidates in blazor webassembly applications.
* Fixes an issue with AppendTargetFramework=false causing issues

dotnet/aspnetcore#35349
dotnet/aspnetcore#32744
dotnet/aspnetcore#29561
dotnet/aspnetcore#35561
javiercn added a commit to dotnet/sdk that referenced this issue Aug 20, 2021
* Fixes an issue with projects not working with reference assemblies
  using HintPath.
* Fixes an issue where files without an extension where being included
  inside an additional folder with the file name on nuget packages.
* Adds additional error logging for the brotli compression tool.
* Adds additional login for the gzip compress task.
* Adds editor config files in the blazor wasm and razor sdk folders
  to handle 'var' usage preferences in ASP.NET Core projects.
* Performs a more selective filtering for static web assets candidates
  from the build candidates in blazor webassembly applications.
* Fixes an issue with AppendTargetFramework=false causing issues

dotnet/aspnetcore#35349
dotnet/aspnetcore#32744
dotnet/aspnetcore#29561
dotnet/aspnetcore#35561
javiercn added a commit to dotnet/sdk that referenced this issue Aug 24, 2021
* Fixes an issue with projects not working with reference assemblies
  using HintPath.
* Fixes an issue where files without an extension where being included
  inside an additional folder with the file name on nuget packages.
* Adds additional error logging for the brotli compression tool.
* Adds additional login for the gzip compress task.
* Adds editor config files in the blazor wasm and razor sdk folders
  to handle 'var' usage preferences in ASP.NET Core projects.
* Performs a more selective filtering for static web assets candidates
  from the build candidates in blazor webassembly applications.
* Fixes an issue with AppendTargetFramework=false causing issues

dotnet/aspnetcore#35349
dotnet/aspnetcore#32744
dotnet/aspnetcore#29561
dotnet/aspnetcore#35561
@ghost ghost locked as resolved and limited conversation to collaborators Sep 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affected-few This issue impacts only small number of customers area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-static-web-assets investigate severity-major This label is used by an internal tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants