Skip to content

Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(442,5): error : Two assets found targeting the same path with incompatible asset kinds #40416

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
vsfeedback opened this issue Feb 25, 2022 · 5 comments
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. feature-static-web-assets ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice] [regression] [worked-in:.Net Core 3.1]
C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(442,5): error : Two assets found targeting the same path with incompatible asset kinds: [D:\Migration\XXXXXX\XXXX.App\XXXX.csproj]
C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(442,5): error : 'D:\Migration\XXXXXX\XXXX.App\wwwroot\assets\images\AAA.png' with kind 'All' [X:\Migration\XXXXXX\XXXX.App\XXXX.csproj]
C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(442,5): error : 'X:\Migration\XXXXXX\XXXX.App\wwwroot\assets\images\AAA.png' with kind 'All' [D:\Migration\XXXXXX\XXXX.App\XXXX.csproj]
C:\Program Files\dotnet\sdk\6.0.101\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(442,5): error : for path 'assets/images/Cancel.png' [D:\Migration\XXXXXX\XXXX.App\XXXX.csproj]
0 Warning(s)
1 Error(s)

Error occurs while building the Solution. Not sure why this error is happening in .NET 6, the same copy of wwwroot folder content to output directory works fine in . Netcore3.1. But giving error in .Net 6.

Did initial research on any other alterative for this problem. It only builds if content of wwwroot folder are deleted each time in the project directory location. hence works fine on the first time of clean workspace.

Background: basically need to copy the icons and images used in client to wwwroot folder and also copying this to output directory using


Original Comments

Feedback Bot on 2/23/2022, 11:53 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

@ghost ghost added the Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. label Feb 25, 2022
@mkArtakMSFT mkArtakMSFT added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-static-web-assets labels Feb 25, 2022
@mkArtakMSFT
Copy link
Member

Thanks for contacting us.
@javiercn can you please look into this? Thanks!

@javiercn
Copy link
Member

javiercn commented Mar 1, 2022

Thanks for contacting us.

Could you provide a minimal repro project that demonstrates the issue as a public github project so that we can make progress?

@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 Mar 1, 2022
@ghost
Copy link

ghost commented Mar 1, 2022

Hi @vsfeedback. 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.

@Shruthi1984
Copy link

Hi @javiercn , please find the link to the project sln in https://github.com/Shruthi1984/StaticWebAssestscopyissue.
try to perform the dotnet build where sln file resides, when there is content in the wwwroot folder inside the project directory StaticWebAssestscopyissue\MyMiniProj\MyMiniProj, you get the build error with above probelm. if there is no wwwroot folder in the project directory StaticWebAssestscopyissue\MyMiniProj\MyMiniProj then dotnet build works fine. Kindly have a look and let me know if you need more information.

@ghost ghost added Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. and removed Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. labels Mar 4, 2022
@javiercn
Copy link
Member

javiercn commented Mar 7, 2022

@Shruthi1984 The issue is in the way you are trying to integrate third-party NPM packages with ASP.NET Core.

We've put out an experimental package a while ago as well as some guidance on how to properly integrate with the pipeline here.

I would recommend you follow those steps to integrate with NPM and upvote the issue mentioned here

@javiercn javiercn closed this as completed Mar 7, 2022
@javiercn javiercn added ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question and removed Needs: Attention 👋 This issue needs the attention of a contributor, typically because the OP has provided an update. labels Mar 7, 2022
@ghost ghost added the Status: Resolved label Mar 7, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Apr 6, 2022
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 Author: Migration Bot 🤖 The issue was created by a issue mover bot. The author may not be the actual author. feature-static-web-assets ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Projects
None yet
Development

No branches or pull requests

4 participants