使用 git 子模块恢复 Nuget 包 [英] Nuget Package restore with git submodule

查看:25
本文介绍了使用 git 子模块恢复 Nuget 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,其中包含来自 git 的 2 个子模块.两个项目都启用了nuget 包还原",父项目也是如此.两个包含的子模块中的包文件夹没有签入,在签出的项目中不存在.在构建父项目时,Nuget 尝试将子文件夹中的包还原到错误的包文件夹中!

i have a project where i include 2 submodules from git. Both projects have "nuget package restore" enabled, the parent project too. The package folder in the two included submodules is not checked in, does not exist in checked out projects. When building the parent project Nuget tries to restore the packages in the subfolders but into the wrong package folder!

"C:Devgitoasisdbodb_oasis_repositoryODB_OASIS_Repository.nugetNuGet.exe" install "C:Devgitoasisdbodb_oasis_repositoryodb_oasis_rvmODB_OASIS_RVM_EFODB_OASIS_RVM_EFpackages.config" -source ""  -NonInteractive -RequireConsent -solutionDir "C:Devgitoasisdbodb_oasis_repositoryODB_OASIS_Repository "

为什么nuget没有在子模块的解决方案目录中恢复?

Why does nuget not restore in the solution dir of the submodule?

谢谢

推荐答案

Nuget 正在恢复打开的解决方案目录中的包.

Nuget is restoring the package in the opened solution directory.

您可以编辑子模块项目的 .csproj 并从以下位置修改包 dll 引用:

You can edit the .csproj of the submodule project and modify package dll references from :

   <ItemGroup>
    <Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>..packagesMicrosoft.Rest.ClientRuntime.2.1.0lib
et45Microsoft.Rest.ClientRuntime.dll</HintPath>
      <Private>True</Private>
    </Reference>

到:

 <ItemGroup>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>$(SolutionDir)packagesMicrosoft.Rest.ClientRuntime.2.1.0lib
et45Microsoft.Rest.ClientRuntime.dll</HintPath>
  <Private>True</Private>
</Reference>

希望对您有所帮助!

这篇关于使用 git 子模块恢复 Nuget 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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