如何在 svn 中使用 NuGet 包?
How to use NuGet-Packages with svn?
在我的项目中安装了一些 NuGet-Packages。 packages.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>
我提交了我的项目并在另一个位置(同一台计算机)更新了它。但是现在我在尝试构建项目时遇到以下错误:
1>------ Build started: Project: OnlineApplicationMapping, Configuration: Release Any CPU ------
1>C:\Program Files (x86)\MSBuild.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.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.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?)
看来,NuGet 包中的 dll 丢失了。
我真的必须将 dll 放入存储库中吗?在这种情况下,NuGet 不应该从某个服务器获取文件吗?
好的。在 Austin T French 和 felix-b 的帮助下,我终于得到了这个(见评论)。我尝试按照 https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore-troubleshooting 章节中的命令进行操作:"Other potential conditions"
这是我做的:
- 我关闭了Visual Studio
- 我删除了 "Packages" 文件夹(在解决方案文件夹中)
- 我从这里下载了最新的NuGet.exe:https://www.nuget.org/downloads
- 我从命令行调用了 "nuget locals all -clear"。
- 我重新打开Visual Studio
- 我右键单击解决方案(在 VS 中)并选择:"Restore Nuget packages"
- 我重建了解决方案
在我的项目中安装了一些 NuGet-Packages。 packages.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>
我提交了我的项目并在另一个位置(同一台计算机)更新了它。但是现在我在尝试构建项目时遇到以下错误:
1>------ Build started: Project: OnlineApplicationMapping, Configuration: Release Any CPU ------
1>C:\Program Files (x86)\MSBuild.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.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.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?)
看来,NuGet 包中的 dll 丢失了。
我真的必须将 dll 放入存储库中吗?在这种情况下,NuGet 不应该从某个服务器获取文件吗?
好的。在 Austin T French 和 felix-b 的帮助下,我终于得到了这个(见评论)。我尝试按照 https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore-troubleshooting 章节中的命令进行操作:"Other potential conditions"
这是我做的:
- 我关闭了Visual Studio
- 我删除了 "Packages" 文件夹(在解决方案文件夹中)
- 我从这里下载了最新的NuGet.exe:https://www.nuget.org/downloads
- 我从命令行调用了 "nuget locals all -clear"。
- 我重新打开Visual Studio
- 我右键单击解决方案(在 VS 中)并选择:"Restore Nuget packages"
- 我重建了解决方案