简体   繁体   中英

Different installation for bootstrap.sass nuget package for ASP.Net Core and Full framework projects

When i create an empty ASP.NET Web Application ( .NET Framework ) project with VS 2017 and install the bootstrap.saas nuget package ( https://www.nuget.org/packages/bootstrap.sass ), the package integrates within the project structure and the Content and Scripts folders are being created. As the folders are within the project folder, i can easily work with them like compile them and minify them and copy the results into my wwwroot folder.

But when i create an empty ASP.NET Web Application ( .NET Core ) project with VS 2017 and install the bootstrap.saas nuget package, the package lands in the global nuget cache in the C:\\Users\\USER_NAME.nuget\\packages\\bootstrap.sass\\4.0.0-alpha6\\content folder and not in the project folder.

What is the best workflow/practice here to work with the nuget cache files and get them compiled and minified to the wwwroot folder within the .NET Core project? Can i force nuget with an additional NuGet.Config file inside my project to install the package within my project folder or subfolder? Are there other options?

I know that i can use npm/webpack/gulp etc. for that but would like to do it the "old" way how Web Extension Pack did it for VS 2015 and like the Web Compiler (both from Mads Kristensen) do it now for VS 2017. Or do i run into a dead end using the Web Compiler?

Thanks

Can i force nuget with an additional NuGet.Config file inside my project to install the package within my project folder or subfolder? Are there other options?

If you want to change packages default location for .net core project, you can set "NUGET_PACKAGES" environment variable. Just Set "NUGET_PACKAGES" = "c:\\teampackages ". Or you can place a NuGet.Config file next to the solution with the following content:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
   <config>
     <add key="globalPackagesFolder" value=".\packages" />
   </config>
</configuration>

For the detail info, you can refer to this document and the same issue on GitHub .

However , what I want to say is that you might not be happy with the results. Because .Net Core projects rely on so many NuGet packages . Almost hovering around 1GB. I think you will not want to set all those packages for each solution. Besides, with this change, you need to set up additional sources in VS for every solution. It`s quite inconvenient for .net core project. This is the reason why NuGet team set the special settings for .net core projects. So how about add the Content and Scripts folders manually? It would not be very difficult.

Hope this can help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM