2016-07-05 125 views
0

對於我經常用於各種項目的通用庫,我設置了一個nuget服務器。一段時間,我手動發佈了nuget包,如:Nuget包裝在VSTS自動化後失敗

nuget pack .\ProjectFolder\CommonProjectName.csproj -Symbols -Build -Properties Configuration=Release 

並手動將此包壓入nuget服務器。

現在我想用在本blogitem描述VSTS建立vNext來自動完成這個出版:http://www.codewrecks.com/blog/index.php/2015/09/26/publishing-a-nuget-package-to-nugetmyget-with-vso-build-vnext/

我用同樣的nuspec文件之前:

<?xml version="1.0"?> 
    <package > 
    <metadata> 
     <id>Common Library</id> 
     <version>1.0.0.0</version> 
     <title>Library Title</title> 
     <authors>...</authors> 
     <owners>...</owners> 
     <requireLicenseAcceptance>false</requireLicenseAcceptance> 
     <description>...</description> 
     <releaseNotes>...</releaseNotes> 
     <copyright>Copyright 2016</copyright> 
     <tags>...</tags> 
     <dependencies> 
     <dependency id="EntityFramework" version="6.1.3" /> 
     <dependency id="log4net" version="2.0.4" /> 
     <dependency id="Microsoft.AspNet.Mvc" version="5.2.3" /> 
     <dependency id="Microsoft.AspNet.Razor" version="3.2.3" /> 
     <dependency id="Microsoft.AspNet.WebPages" version="3.2.3" /> 
     <dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" /> 
     </dependencies> 
    </metadata> 
</package> 

現在自動化後,我得到以下錯誤消息:

說明:程序集'bin \ Release \ CommonLibrary.dll'不在'lib'文件夾中,因此在程序包安裝到項目中時不會將其作爲參考添加。 解決方案:如果應該引用該文件夾,請將其移動到「lib」文件夾中。 問題:在lib文件夾外裝配。

我在nuget站點閱讀包約定部分,但是如何自動遵守這些約定。換句話說,我如何在buidcontroller的正確位置獲得構建和引用的dll。

感謝您的幫助,

親切的問候, Luuk Krijnen

額外:下載使用FTP我的完整源代碼如逢ALS我編譯的源代碼被添加到包中的NuGet包後樹就像我的原始源代碼。所以我編的DLL是去文件夾內的\ BIN \發佈\

回答

0

添加文件部分的nuspec文件中添加的目標似乎是解決方案:

<?xml version="1.0"?> 
    <package > 
    <metadata> 
     <id>Common Library</id> 
     <version>1.0.0.0</version> 
     <title>Library Title</title> 
     <authors>...</authors> 
     <owners>...</owners> 
     <requireLicenseAcceptance>false</requireLicenseAcceptance> 
     <description>...</description> 
     <releaseNotes>...</releaseNotes> 
     <copyright>Copyright 2016</copyright> 
     <tags>...</tags> 
     <dependencies> 
     <dependency id="EntityFramework" version="6.1.3" /> 
     <dependency id="log4net" version="2.0.4" /> 
     <dependency id="Microsoft.AspNet.Mvc" version="5.2.3" /> 
     <dependency id="Microsoft.AspNet.Razor" version="3.2.3" /> 
     <dependency id="Microsoft.AspNet.WebPages" version="3.2.3" /> 
     <dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" /> 
     </dependencies> 
    </metadata> 
    <files> 
     <file src="<TARGET SPECIFIC FILE.DLL>" target="lib" /> 
     <file src="<TARGET SPECIFIC FILE.PDB>" target="lib" /> 
     ... 
    </files> 
</package>