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

.Net 6 Preview 7 SDK seems to replicate resources from NuGet packages #36335

Closed
MarkStega opened this issue Sep 1, 2021 · 9 comments
Closed
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Docs This issue tracks updating documentation Done This issue has been fixed feature-static-web-assets Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.

Comments

@MarkStega
Copy link

I have a solution that has multiple csproj/dll's; Prior to P7, I had references to the Nuget package 'Material.Blazor' in four of those csproj. With P7 the build failed with duplicate static content. Upon examination of the graphic view of the projects each that had the reference to Material.Blazor has content in wwwroot corresponding to the content in Material.Blazor (4 css files and 2 js files).

I had to remove references to Material.Blazor in three of the csproj projects and reply on them to reference the one csproj that included Material.Blazor.

Does this mean that the content is not only bundled in the included Material.Blazor nuget package but is also replicated in the assets of the project that references Material.Blazor?

@pranavkm pranavkm transferred this issue from dotnet/sdk Sep 9, 2021
@Pilchie Pilchie added feature-static-web-assets area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Sep 9, 2021
@mkArtakMSFT mkArtakMSFT added this to the 6.0.0 milestone Sep 14, 2021
@mkArtakMSFT
Copy link
Member

Thanks for contacting us.
@javiercn this seems to be a valid scenario. How should this be handled?

@mkArtakMSFT mkArtakMSFT added Docs This issue tracks updating documentation and removed investigate labels Sep 21, 2021
@mkArtakMSFT mkArtakMSFT modified the milestones: 6.0.0, 6.0-docs-infra Oct 19, 2021
@javiercn
Copy link
Member

@MarkStega We believe this issue was caused because the content was being included as content and contentFiles within the nuget package. We believe this is solved in the RC2/RTM builds (to be sure, you can try using the nightly RTM bits, as there was an incrementalism bug that affected packing that didn't make it into the RC2 build and that could affect you if you were running pack after build or pack multiple times).

@javiercn
Copy link
Member

Let us know if you still run into this issue with the RTM bits.

@javiercn javiercn added the Done This issue has been fixed label Oct 29, 2021
@javiercn
Copy link
Member

I'm closing this for now as we believe the issue is fixed (@MarkStega also check out the answer I gave you in a similar issue regarding client assets compiled to the wwwroot folder as the output).

Please let us know if after applying our suggestions you still run into issues and we'll reopen this ticket.

@MarkStega
Copy link
Author

MarkStega commented Nov 11, 2021

I just tried this scenario using VS2022 17.1P1 & Net 6.0 RTM and the issue is still present

Severity	Code	Description	Project	File	Line	Suppression State
Error		Conflicting assets with the same target path 'material.blazor.css'. For assets 'Identity: C:\Users\ms\.nuget\packages\material.blazor\2.0.0\contentFiles\any\net6.0\wwwroot\material.blazor.css, SourceType: Discovered, SourceId: Optimiser.2021.Web, ContentRoot: C:\Solutions\OHI\Optimiser\Optimiser.2021.Web\wwwroot\, BasePath: _content/Optimiser.2021.Web, RelativePath: material.blazor.css, AssetKind: All, AssetMode: All, AssetRole: Primary, RelatedAsset: , AssetTraitName: , AssetTraitValue: , CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: C:\Users\ms\.nuget\packages\material.blazor\2.0.0\contentFiles\any\net6.0\wwwroot\material.blazor.css' and 'Identity: C:\Users\ms\.nuget\packages\material.blazor\2.0.0\contentFiles\any\net6.0\wwwroot\material.blazor.css, SourceType: Project, SourceId: Optimiser.2021.Blazor, ContentRoot: C:\Solutions\OHI\Optimiser\Optimiser.2021.Blazor\wwwroot\, BasePath: /, RelativePath: material.blazor.css, AssetKind: All, AssetMode: All, AssetRole: Primary, RelatedAsset: , AssetTraitName: , AssetTraitValue: , CopyToOutputDirectory: Never, CopyToPublishDirectory: PreserveNewest, OriginalItemSpec: C:\Users\ms\.nuget\packages\material.blazor\2.0.0\contentFiles\any\net6.0\wwwroot\material.blazor.css' from different projects.	Optimiser.2021.Web	C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets	411	

@javiercn
Copy link
Member

@MarkStega do you have a project that we can take a look at?

@javiercn
Copy link
Member

@MarkStega did you follow the instructions we provided #35274 (comment)

Also note the explanatory blog post here

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Nov 11, 2021
@ghost
Copy link

ghost commented Nov 11, 2021

Hi @MarkStega. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@MarkStega
Copy link
Author

MarkStega commented Nov 11, 2021

@javiercn -- I am simply adding the nuget package Material.Blazor to the three projects in a hosted wasm app.

See https://github.com/OptimiumHealth/BlazorAppMultipleNugetPackages

I am simply adding nuget packages that have content; I fail to understand how the detail in the blog post will help.

[EDIT] I see the issue but don't know why it happens. Simply adding a nuget package to a project now results in the assets from that nuget package getting placed in a wwwroot folder so when the name resolution occurs there is a conflict.

[EDIT2] This seem problematic if I am using two different nuget packages of RCL's and they both define 'Styles.css' (a real possibility) then isn't a collision going to occur? It seems that the name of the asset alone isn't enough and it needs the package name so that you know the source of the asset. And if the asset is in multiple csproj projects then you need it to know to ignore duplicates

[EDIT3] No, I haven't updated my real project to the new scheme outlined in #35274 (comment) ; I will at some point, but it was so painful to get the js & css generated I've been loath to mess with success.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Docs This issue tracks updating documentation Done This issue has been fixed feature-static-web-assets Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue.
Projects
None yet
Development

No branches or pull requests

4 participants