項目間的依賴我無法弄清楚如何與一個解決方案項目和第三方組件的NuGet:在溶液
我有2個項目,A
和B
溶液中引用創建一個包。 B
參考文獻A
。此外,B
引用C
這是一個dll位於Solution/libs
A
和B
都應該是的NuGet包。
我有一個B.nuspec
文件,該文件是這樣的:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>B</id>
<version>$version$</version>
<title>B</title>
<authors>me</authors>
<owners>me</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
<copyright>Copyright © me 2016</copyright>
<references>
<reference file="C.dll" />
</references>
</metadata>
<files>
<file src="..\libs\RMS\C.dll" target="lib"/>
</files>
</package>
我運行以下命令: nuget pack B.csproj -IncludeReferencedProject
正如本的NuGet文檔中說,將的NuGet從的csproj和nuspec結合信息。然而...
它給了我A.dll
和B.dll
在\lib\net45
和nupkg在\lib
C.dll
。也有一個nuspec文件
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
<metadata>
<id>B</id>
<version>1.0.31</version>
<title>B</title>
<authors>me</authors>
<owners>me</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Description</description>
<copyright>Copyright © me 2016</copyright>
<dependencies>
<dependency id="log4net" version="2.0.2" />
<dependency id="JetBrains.Annotations" version="9.2.0" />
<dependency id="morelinq" version="1.4.0" />
</dependencies>
<references>
<reference file="C.dll" />
</references>
</metadata>
</package>
當我安裝包到項目,沒有A
,B
,C
參考。
我的設置有什麼問題?有沒有辦法創建一個包含從csproj和手動指定的引用(或者有一些隱藏的約定)的依賴包的方法?
嘿,你找到一個解決方案?我在這裏面對的東西很相似 - http://stackoverflow.com/questions/36796591/nuget-package-referenced-assemblies-are-not-being-included-as-project-referenc – pharophy
@pharophy是的,我剛剛添加C.dll到nuspec中的lib \ net40。重點是你需要將文件放在lib中的一個子文件夾中...... net45或net40 –