具有特定 .NET 版本的 NuGet 包管理器 [英] NuGet package manager with a specific version of .NET

查看:61
本文介绍了具有特定 .NET 版本的 NuGet 包管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在似乎 Visual Studio 2013 和 .NET 4.5.1 已经发布,许多 NuGet 包现在只支持 .NET 4.5 及更高版本.我们有较旧的服务器,并且大部分时间都停留在 .NET 4.0 上,因此在没有包本身或其依赖包之一失败的情况下更新包变得越来越困难,因为它不是针对 .net 4.0 的.

It seems now that Visual Studio 2013 and .NET 4.5.1 are out, many NuGet packages now only support .NET 4.5 and above. We have older servers and are stuck on .NET 4.0 for the most part, so it has become increasingly difficult to update a package without either the package itself or one of its dependent packages failing because it's not targeted for .net 4.0.

有没有办法告诉包管理器只获取适用于 4.0 框架的包?

Is there a way to tell the package manager to only get packages that are for the 4.0 framework?

我猜我们将不得不创建一个内部 NuGet 服务器,然后煞费苦心地手动更新其中的 .NET 4.0 包,但必须有更好的解决方案.

I am guessing we will have to create an internal NuGet server and then painstakingly manually update packages in there for .NET 4.0, but there has to be a better solution.

推荐答案

在每个项目的 packages.config 中,您可以指定目标框架版本:

In your packages.config for each project you can specify your target framework version:

<package id="NLog" version="2.1.0" targetFramework="net40" />

这篇关于具有特定 .NET 版本的 NuGet 包管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆