简体   繁体   English

Nuget包没有Package.Config?

[英]Nuget Package without Package.Config?

I encountered a solution (.Net Full framework) Where there are no package.config in the solution and Feeds coming from In house Nuget servers. 我遇到了一个解决方案(.Net Full框架),该解决方案中没有package.config,并且Feed均来自内部Nuget服务器。

Where list of packages are maintained, if not in Package.Config? 如果不在Package.Config中,则在哪里维护软件包列表?

Where is the list of packages are maintained, if not in Package.Config? 如果不在Package.Config中,则维护软件包列表的位置在哪里?

First, you should make sure you have that solution have already installed the nuget package, once you install a package, NuGet will add Package.Config file to your project to record the dependency in either your project file or a packages.config file. 首先,您应该确保已经安装了解决方案nuget软件包,一旦安装了软件包,NuGet就会将Package.Config文件添加到项目中,以将依赖项记录在项目文件或packages.config文件中。

If you confirm that your solution has a nuget package installed, but there is no Package.Config file, your nuget package should use another management method: PackageReference 如果确认您的解决方案已安装了nuget软件包,但没有Package.Config文件,则您的nuget软件包应使用另一种管理方法: PackageReference

Edit your project, you will find following PackageReference list: 编辑您的项目,您会发现以下PackageReference列表:

<ItemGroup>
    <PackageReference Include="Contoso.Utility.UsefulStuff" Version="3.6.0" />
</ItemGroup>

See NuGet is now fully integrated into MSBuild for more details: 有关更多详细信息,请参见NuGet现在已完全集成到MSBuild中:

In the past, NuGet packages were managed in two different ways - packages.config and project.json - each with their own sets of advantages and limitations. 过去,NuGet软件包以两种不同的方式进行管理-packages.config和project.json-每种方法都有各自的优点和局限。 With Visual Studio 2017 and .NET Core, we have improved the NuGet package management experience by introducing the PackageReference feature in MSBuild. 使用Visual Studio 2017和.NET Core,我们通过在MSBuild中引入PackageReference功能来改善NuGet软件包管理体验。 PackageReference brings new and improved capabilities such as deep MSBuild integration, improved performance for everyday tasks such as install and restore, multi-targeting and more. PackageReference带来了新的改进功能,例如深度MSBuild集成,改进了日常任务(如安装和还原),多目标的性能等。

The packages.config file could be somewhere else? packages.config文件可能在其他地方? In that case look in your msbuild project file (ie *.csproj, *.vbproj, *.vcxproj) and see where the references to that nuget assembly are coming from. 在这种情况下,请查看您的msbuild项目文件(即* .csproj,*。vbproj,*。vcxproj),然后查看对该nuget程序集的引用来自何处。 Then look in that directory for the packages.config file. 然后在该目录中查找packages.config文件。 It might be more complicated than that, in which case, it's useful to do a global search for packages.config in your repo, to see where they reside (If they do exist at all). 可能比这更复杂,在这种情况下,在存储库中全局搜索packages.config很有用,以查看它们的位置(如果它们确实存在)。

This is a common practice: To have one project specify the nuget package, and all the other projects borrow it. 这是一种常见的做法:让一个项目指定nuget包,其他所有项目都借用它。 As Jon said, this is really dependent on how the folks at your company and department set up your builds and dependencies. 正如Jon所说,这实际上取决于公司和部门人员如何建立内部版本和依赖关系。

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

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