I created a new .net 6.0 MVC Web project
and removed the preinstalled bootstrap
from wwwroot/lib
because I wanted to add it with NuGet Package Manager
. After installing the package, files are shown as a reference in my wwwroot
, and when I try to link them from code browser gives not found error
cause they don't actually exists in my project.
Now I'm trying this: <link rel="stylesheet" href="~/css/bootstrap.min.css" />
but as I said is not working. The only solution I've got is to copy those file from C\..nuget\packages
to my wwwroot
but I've read that this reference is actually an intended behaviour from Microsoft, so it should be a way to use those referenced files but I can't seem to find it.
How should I reference those files in my code to be able to use them?
Also after copying files to project and running the project I get this error:
Severity Code Description Project File Line Suppression State Error Two assets found targeting the same path with incompatible asset kinds: 'C:\Users....nuget\packages\bootstrap\5.3.0\contentFiles\any\any\wwwroot\css\bootstrap-grid.css' with kind 'All' '...\Tickets\Tickets\wwwroot\css\bootstrap-grid.css' with kind 'All' for path 'css/bootstrap-grid.css' Tickets C:\Program Files\dotnet\sdk\7.0.306\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets 419
I need to remove the package from manager to overcome this error...