简体   繁体   English

用于ASP.Net Core和Full Framework项目的bootstrap.sass nuget软件包的不同安装

[英]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. 当我使用VS 2017创建一个空的ASP.NET Web应用程序( .NET Framework )项目并安装bootstrap.saas nuget软件包( https://www.nuget.org/packages/bootstrap.sass )时,该软件包将集成在正在创建项目结构以及“内容和脚本”文件夹。 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. 由于这些文件夹位于项目文件夹中,因此我可以轻松地像使用它们一样对其进行编译和缩小,然后将结果复制到我的wwwroot文件夹中。

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. 但是,当我使用VS 2017创建一个空的ASP.NET Web应用程序( .NET Core )项目并安装bootstrap.saas nuget程序包时,该程序包将位于C:\\ Users \\ USER_NAME.nuget \\ packages \\的全局nuget缓存中bootstrap.sass \\ 4.0.0-alpha6 \\ content文件夹,不在项目文件夹中。

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? 在这里,与nuget缓存文件一起工作并使它们编译并缩小到.NET Core项目内的wwwroot文件夹中的最佳工作流程/做法是什么? Can i force nuget with an additional NuGet.Config file inside my project to install the package within my project folder or subfolder? 我可以在项目内使用其他NuGet.Config文件强制nuget将软件包安装在项目文件夹或子文件夹中吗? 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? 我知道我可以为此使用npm / webpack / gulp等,但是想以Web扩展包为VS 2015做它的“旧”方式,就像Web编译器(都来自Mads Kristensen)一样,现在就这样做VS2017。还是使用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? 我可以在项目内使用其他NuGet.Config文件强制nuget将软件包安装在项目文件夹或子文件夹中吗? Are there other options? 还有其他选择吗?

If you want to change packages default location for .net core project, you can set "NUGET_PACKAGES" environment variable. 如果要更改.net核心项目的软件包默认位置,则可以设置“ NUGET_PACKAGES”环境变量。 Just Set "NUGET_PACKAGES" = "c:\\teampackages ". 只需设置"NUGET_PACKAGES" = "c:\\teampackages ”。 Or you can place a NuGet.Config file next to the solution with the following content: 或者,您可以在解决方案旁边放置一个NuGet.Config文件,其中包含以下内容:

<?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 . 有关详细信息,您可以参考此文档以及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 . 因为.Net Core项目依赖于如此多的NuGet软件包 Almost hovering around 1GB. 几乎徘徊在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. 此外,通过此更改,您需要为每个解决方案在VS中设置其他源。 It`s quite inconvenient for .net core project. .net核心项目非常不便。 This is the reason why NuGet team set the special settings for .net core projects. 这就是NuGet团队为.net核心项目设置特殊设置的原因。 So how about add the Content and Scripts folders manually? 那么如何手动添加Content和Scripts文件夹呢? It would not be very difficult. 不会很困难。

Hope this can help you. 希望这可以帮到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有完整框架和单元测试项目的Scaffold ASP.NET Core - Scaffold ASP.NET Core with Full Framework and Unit Test Projects 完整.NET Framework上ASP.NET Core项目内的NuGet文件夹中的参考DLL - Reference DLL from NuGet folder inside ASP.NET Core project on full .NET framework Nuget包:仅在asp.net项目中复制一些文件 - Nuget package : Copy some files only in asp.net projects 用于面向完整框架的项目的asp.net core 2.0 docker映像 - asp.net core 2.0 docker image for projects targeting full framework ASP.NET Core 中的 NuGet 包位置在哪里? - Where's the NuGet package location in ASP.NET Core? In .NET Core, ASP.NET Core - What is the relationship between Package, Reference, NuGet Package, DLL file, Namespace - In .NET Core, ASP.NET Core - What is the relationship between Package, Reference, NuGet Package, DLL file, Namespace 为ASP.NET 4和ASP.NET Core 1.0创建一个Nuget包 - Create one Nuget Package for both ASP.NET 4 & ASP.NET Core 1.0 Visual Studio asp.net完整框架项目中的Bootstrap 4 - Bootstrap 4 in Visual Studio asp.net full framework project 具有完整框架的ASP NET Core 2 - ASP NET Core 2 with Full Framework 如果支持 .Net Standard 2.0 的 nuget 包,那么我们可以在 asp.net 和 asp.net core 中使用该包吗? - If a nuget Package is .Net Standard 2.0 supported then can we use that package in asp.net as well as asp.net core?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM