![](/img/trans.png)
[英]Why .net shows version conflict for same nuget package which is internal dependency for 3rd party library/package?
[英]NuGet dependency of the same version
我想在我们的TeamCity构建服务器上自动生成nuget软件包。 我们使用TeamCity AssemblyInfo Patcher使特定内部版本的所有dll具有相同的版本号。
我们从项目中生成多个NuGet包。 如何在依赖项字段中指定版本号,以便它使用与正在构建的软件包相同的版本号, 而无需在NuGet .spec文件中对版本号进行硬编码 ?
例如, MyProject.Plugins
需要MyProject.Math
。 因此,对于MyProject.Plugins 1.2.3.45
,依赖关系应如下所示:
<dependencies>
<dependency id="MyProject.Math" version="1.2.3.45" />
</dependencies>
TeamCity的NuGet包包括一个版本号字段。
如果您使用AssemblyInfoPatcher,我们可以只使用在此指定的数字。
对于使用文件内容替换器的更复杂方法,可以使用一个小的PowerShell脚本从已编译的dll中读取版本号,并将其存储在teamcity配置参数%ActualVersion%中
$DllFileName = "MyDll.dll"
$PathPrefix = "bin/Release/"
$Version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($PathPrefix + $DllFileName).FileVersion
Write-Host "##teamcity[setParameter name='ActualVersion' value='$Version']"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.