【发布时间】:2017-04-12 04:05:58
【问题描述】:
我有一个第三方 DLL,我需要在一个解决方案的多个 c# 项目中引用它。
现引用如下。
<Reference Include="Contoso.App, Version=4.0.5.0, Culture=neutral, PublicKeyToken=xxxxxxxx, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\Contoso\4.0.5.0\Contoso.App.dll</HintPath>
</Reference>
我的解决方案中有大约 40 个引用 Contoso.App.Dll 的项目
每当 DLL 版本更改时,都会按如下方式创建一个新文件夹
..\ThirdParty\Contoso\5.0\
我必须去更新我所有的 40 个项目,如下所示。
<Reference Include="Contoso.App, Culture=neutral, PublicKeyToken=xxxxxxxx, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\Contoso\5.0\Contoso.App.dll</HintPath>
</Reference>
有没有更好的方法来管理 DLL 的版本变化?
我可以在解决方案中创建单个变量并在所有项目中重复使用它吗?
【问题讨论】:
-
您是在解决方案中的所有项目中都使用它还是只是其中的一个子集?
-
其实并不是所有的项目。我在解决方案中有大约 70 个项目。其中 40 个引用了 DLL。
-
你为什么不使用
\ThirdParty\Contoso\CurrentVersion\Contoso.App.dll作为路径并将dll版本5.0复制到它。 -
你不能使用 nuget 包吗?
-
@TriV 您的解决方案将不起作用,因为我还必须在参考节点中更新版本。查看我的最新编辑。