简体   繁体   English

如何在 svn 中使用 NuGet-Packages?

[英]How to use NuGet-Packages with svn?

In my project there are some NuGet-Packages installed.在我的项目中安装了一些 NuGet-Packages。 The packages.config looks like this: package.config 看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr3.Runtime" version="3.5.1" targetFramework="net461" />
  <package id="FluentNHibernate" version="2.1.2" targetFramework="net461" />
  <package id="Iesi.Collections" version="4.0.4" targetFramework="net461" />
</packages>

I commited my project and updated it on another location (same computer).我提交了我的项目并在另一个位置(同一台计算机)上更新了它。 But now I get the following errors when I try to build the project:但是现在当我尝试构建项目时出现以下错误:

1>------ Build started: Project: OnlineApplicationMapping, Configuration: Release Any CPU ------
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "FluentNHibernate, Version=2.1.2.0, Culture=neutral, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Iesi.Collections, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\branches\Version\OnlineApplicationMapping\Mapping\ONLINE_ANTRAG_TYPMap.cs(1,7,1,23): error CS0246: The type or namespace name 'FluentNHibernate' could not be found (are you missing a using directive or an assembly reference?)
1>C:\branches\Version\OnlineApplicationMapping\Mapping\ONLINE_BEFUELL_MAPMap.cs(1,7,1,23): error CS0246: The type or namespace name 'FluentNHibernate' could not be found (are you missing a using directive or an assembly reference?)
1>C:\branches\Version\OnlineApplicationMapping\Mapping\ONLINE_ANTRAG_TYPMap.cs(11,34,11,61): error CS0246: The type or namespace name 'ClassMap<>' could not be found (are you missing a using directive or an assembly reference?)
1>C:\branches\Version\OnlineApplicationMapping\Mapping\ONLINE_BEFUELL_MAPMap.cs(11,35,11,63): error CS0246: The type or namespace name 'ClassMap<>' could not be found (are you missing a using directive or an assembly reference?)

It seems like, the dlls from the NuGet-Packages are missing.看起来,NuGet-Packages 中的 dll 丢失了。

Do I really have to put the dlls in the repository?我真的必须将 dll 放在存储库中吗? Isn't NuGet supposed to get the files from some server in this case?在这种情况下,NuGet 不应该从某个服务器获取文件吗?

ok.好的。 I finally got this with the help of Austin T French and felix-b (see comments).我终于在 Austin T French 和 felix-b 的帮助下得到了这个(见评论)。 I tried to follow the orders from https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore-troubleshooting Chapter: "Other potential conditions"我试图按照https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore-troubleshooting章节中的命令进行操作:“其他潜在条件”

This is what I did:这就是我所做的:

  • I closed Visual Studio我关闭了 Visual Studio
  • I deleted the "Packages" Folder (in the solution-folder)我删除了“包”文件夹(在解决方案文件夹中)
  • I downloaded the latest NuGet.exe from here: https://www.nuget.org/downloads我从这里下载了最新的 NuGet.exe: https ://www.nuget.org/downloads
  • I called "nuget locals all -clear" from the command line.我从命令行调用了“nuget locals all -clear”。
  • I reopend Visual Studio我重新打开了 Visual Studio
  • I right-clicked on the solution (in VS) and chose: "Restore Nuget packages"我右键单击解决方案(在 VS 中)并选择:“还原 Nuget 包”
  • I rebuilded the solution我重建了解决方案

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

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