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

RCL + Libman: Restored files don't get packed / published at the correct location in final app. #634

Open
TFTomSun opened this issue Jul 8, 2021 · 3 comments

Comments

@TFTomSun
Copy link

TFTomSun commented Jul 8, 2021

Copy from the original issue I filed in the AspNet.Core repo:
dotnet/aspnetcore#34039

Describe the bug

Files that are restored with the Microsoft.Web.LibraryManager.Build (LibMan) inside a Razor Class Library (RCL) are not deployed to the correct location in the final consuming app (e.g. Blazor Server App).
Instead of being deployed to:
wwwroot/_content/<RCL Package Name>/
they are deployed to
wwwroot/

This happens only if the files are not yet restored when you pack / publish the app. Once the files are restore they are correctly deployed in subsequent builds.

dotnet version:
5.0.300
environments:
dotnet cli (e.g. dotnet pack)
Visual Studio (pack context menu)

Solution

I found out that the ResolveCurrentProjectStaticWebAssetsInputs target takes content files as its input. The LibraryManagerRestore on the other hand doesn't produce content items. If you apply the following workaround, the issue disappears:

...
  <PropertyGroup>

<ResolveCurrentProjectStaticWebAssetsInputsDependsOn>LibraryManagerRestore;FixLibManRestore;$(ResolveCurrentProjectStaticWebAssetsInputsDependsOn)</ResolveCurrentProjectStaticWebAssetsInputsDependsOn>

  </PropertyGroup>
  
  <Target Name="FixLibManRestore" AfterTargets="LibraryManagerRestore">
  <ItemGroup>
            <Content  Include="%(FilesForPackagingFromProject.Identity)" Exclude="@(Content)">
            </Content>
        </ItemGroup>
		
  </Target>

...
@sayedihashimi
Copy link

Thanks for the report. We are aware of a few issues when working with Razor Class Libraries. I'm working on a proposal currently, and I'll include this work into that.

@Tragetaschen
Copy link

Is there any progress? I have just spent too much time figuring out that this issue caused a production failure

@theknut
Copy link

theknut commented Dec 15, 2023

Any update on this? If there is a proposed solution, why not use it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants