简体   繁体   English

离线构建 .NET Core 应用程序不会创建“NuGetFallbackFolder”文件夹

[英]Building of .NET Core application offline doesn't create the "NuGetFallbackFolder" folder

I had installed VS2019 and running "dotnet --version" command shows "3.1.100".我已经安装了 VS2019 并运行“dotnet --version”命令显示“3.1.100”。

When i try to build a .NET standard library project without connecting to the network the following error is thrown当我尝试在不连接网络的情况下构建 .NET 标准库项目时,抛出以下错误

"error NU1100: Unable to resolve 'NETStandard.Library (>= 2.0.3)' for '.NETStandard,Version=v2.0' “错误 NU1100:无法为 '.NETStandard,Version=v2.0' 解析 'NETStandard.Library (>= 2.0.3)'

My project has the following tag我的项目有以下标签

<TargetFramework>netstandard2.0</TargetFramework>

Earlier i was using Binaries of "dotnet-sdk-2.1.301-win-x64" and when i build the project, the restore command was automatically extracting and creating the "NuGetFallbackFolder" folder when i was building without connecting to the network.早些时候我使用了“dotnet-sdk-2.1.301-win-x64”的二进制文件,当我构建项目时,当我在没有连接到网络的情况下构建时,恢复命令会自动提取并创建“NuGetFallbackFolder”文件夹。

The same doesn't happen after installing VS2019.安装 VS2019 后不会发生同样的情况。

IS there a workaround for this?有解决方法吗?

Copied from github:复制自github:

Starting in VS 16.3 and .NET Core 3.0, we no longer use a nuget fallback folder.从 VS 16.3 和 .NET Core 3.0 开始,我们不再使用 nuget 回退文件夹。 A side-effect of this is that in order for you to be able to work with .NET Standard 2.0 offline, you need to restore a .net standard 2.0 project at least once while online.这样做的一个副作用是,为了能够脱机使用 .NET Standard 2.0,您需要在联机时至少恢复 .net Standard 2.0 项目一次。 And every time if you clean your NuGet cache每次如果你清理你的 NuGet 缓存

.NET Standard 2.0 projects can be compiled on .NET Core 3.1.100 SDK successfully. .NET Standard 2.0 项目可以在 .NET Core 3.1.100 SDK 上成功编译。 Ensure that you are not having global.json with older SDK defined.确保您没有定义旧 SDK 的 global.json。

Because based on that error you have, the inability to restore ".NET Standard 2.0.3" means that somewhere in your codes you have global.json or you are explicitly referencing .NET runtime version in the csproj, instead of just using TFM of netstandard2.0 as main target defined in the csproj file.因为基于您遇到的那个错误,无法恢复“.NET Standard 2.0.3”意味着您的代码中的某处有 global.json 或者您在 csproj 中明确引用了 .NET 运行时版本,而不是仅使用 TFM netstandard2.0作为 csproj 文件中定义的主要目标。

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

相关问题 上传文件以创建目录ASP.Net Core Mac OS不会创建子文件夹 - File upload to create directory ASP.Net core mac os doesn't create sub folder SignalR 不适用于 .net 内核 WPF 应用程序 - SignalR doesn't work with .net core WPF application 向没有 .Net Core 的用户发布 VS 2019 .Net Core 应用程序 - Publishing VS 2019 .Net Core Application to User who Doesn't Have .Net Core 从 Visual Studio 启动 ASP.NET Core 不是从构建文件夹启动 - Starting ASP.NET Core from Visual Studio doesn't start from build folder WPF应用程序不在其他文件夹中运行 - WPF application doesn't run in another folder .net WPF应用程序创建一个安全文件夹 - .net WPF application create a secure folder 将包添加到.NET Core应用程序时,Visual Studio 2017不会自动安装依赖项 - Visual Studio 2017 doesn't install dependencies automatically when adding a package to a .NET Core application 在为.net core 2.1.5 Web应用程序生产时,Serilog不会在MSSqlServer数据库中创建日志 - Serilog doesn't create logs in MSSqlServer database when in production for .net core 2.1.5 web app 在 .net core 控制台应用程序中创建一个 websocket 服务器 - Create a websocket server in .net core console application .Net Core XmlDocument不返回声明 - .Net Core XmlDocument doesn't return declaration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM