所以,我有这个设置:
InternalLibrary
,一个是InternalMVCLibrary
,一个是MVC
InternalLibrary
没有依赖项,没有 nuget 包等..InternalMVCLibrary
和 MVC
都需要参考 nuget中的
InternalLibrary
MVC
需要包含 InternalMVCLibrary
作为 nuget 包现在,我想要实现的是:
InternalMVCLibrary
将 InternalLibrary
作为 nuget 包,但是,我想在其中隐藏 InternalLibrary
的内容,以便我可以独立地引用 InternalLibrary
到 MVC
(发生更新时的不同版本等。)
如何使用 .net 4.8 实现这一目标?
我试过添加
<Reference Include="InternalLibrary, Version=1.27.6.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>packages\InternalLibrary.1.27.8\lib\net48\InternalLibrary.dll</HintPath> <Private>False</Private> <!-- ??? --> </Reference>
To
InternalMVCLibrary
,但是,当我尝试将 InternalMVCLibrary
安装到 MVC
sln 时,它还会安装具有特定版本的 InternalLibrary
并且我无法更新它或将其从 MVC 项目中删除,因为 InternalMVCLibrary
依赖于它.
尝试使用nuspec,将InternalLibrary设置为InternalMVCLibrary的内置编译。
<dependencies>
<group>
<dependency id="InternalLibrary" version="1.27.6" exclude="Compile" />
</group>
</dependencies>
通过这种方式,您可以在 MVC 中更新 InternalLibrary 的版本,而不会影响 InternalMVCLibrary 中的版本。