简体   繁体   English

使用 nuget package 代替项目参考 Visual Studio

[英]Use nuget package instead of project reference Visual studio

We have a solution with 7 to 8 different projects including class libraries and mvc apps.我们有一个包含 7 到 8 个不同项目的解决方案,包括 class 库和 mvc 应用程序。 We are using .net 4.6.2 and netstandard 2.0.我们正在使用 .net 4.6.2 和 netstandard 2.0。

We are trying to convert class libraries to nuget packages and instead of referencing the projects directly in our web apps, use nuget packages.我们正在尝试将 class 库转换为 nuget 包,而不是直接在我们的 web 包中引用项目,而是使用 Z0557844081469C782 包。 We have created the packages and added them in packages.config and the packages are getting installed perfectly fine.我们已经创建了包并将它们添加到 packages.config 中,并且包安装得非常好。

Now, when I remove previous reference and add a new reference and point it to the nuget package, my web apps doesn't work and give assembly not found error.现在,当我删除以前的引用并添加新的引用并将其指向 nuget package 时,我的 web 应用程序不起作用并给出未找到装配错误。

I think I'm not adding the reference correctly, and need help on this.我想我没有正确添加参考,需要帮助。

If you are using NuGet packages now then you would install the package into each project which needs the assemblies and NuGet will add the references for you.如果您现在正在使用 NuGet 包,那么您可以将 package 安装到需要程序集的每个项目中,NuGet 将为您添加参考。 You don't add the references by adding them from the packages directory.您不会通过从包目录中添加引用来添加引用。

Eg Install-Package MyPackage MyProject例如 Install-Package MyPackage MyProject

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

相关问题 在没有Visual Studio的项目中添加NuGet包 - Adding a NuGet package to a project without Visual Studio 引用 a.Net Core 3.1 NuGet package 的 a.Net 5 Visual Studio 项目/解决方案如何编译成功? - How can a .Net 5 Visual Studio Project / Solution that reference a .Net Core 3.1 NuGet package compile successfuly? Visual Studio NuGet:下载官方软件包而不是预发行版 - Visual Studio NuGet: Download the official package instead of pre-release 在不使用Visual Studio的情况下将nuget包添加到项目文件中 - Add nuget package into project file without Visual Studio 无法在Visual Studio 2015 Web API项目中添加nuget程序包 - Can not add a nuget package in visual studio 2015 web api project 在Visual Studio中构建项目时如何安装Nuget包 - How install Nuget package when building project in Visual Studio 是否有任何 NuGet API 可以从 Visual Studio 扩展项目创建包 - Is there any NuGet API to create a Package from a Visual Studio Extension project Visual Studio 2015 - NuGet包删除所有项目引用 - Visual Studio 2015 - NuGet package removes all project references Nuget 包未在 Visual Studio 中更新 - Nuget package not updating in Visual Studio 安装项目Visual Studio和Nuget - Setup project Visual Studio and Nuget
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM