2015-01-15 72 views
22

當我安裝我的自定義NuGet包時,它的工作原理是,但VS中的輸出窗口顯示消息,比如試圖添加文件兩次,並且它們已經存在。在這篇文章中,輸出進一步下降。自定義NuGet包安裝輸出窗口消息

我在這裏的服務器上有一個NuGet私有存儲庫,用於託管我們的圖庫。即使輸出窗口顯示以下消息,安裝和卸載仍在運行。我對spec文件中的<files>標籤感到好奇,如果有其他不同的方式,我需要這樣做。我基於文檔嘗試了多種方法。我的版本是最新從NuGet網站安裝的。

從網站:The latest version of the nuget.exe command-line tool is always available from http://nuget.org/nuget.exe

Specifying files to include in the package

輸出窗口顯示了安裝,包裝CustomNuGet這樣的事情:

項/插件/ CustomNuGet/CSS /自定義。 CSS已經存在。

項目/Plugins/CustomNuGet/Scripts/custom.js已經存在。

項目/Plugins/CustomNuGet/Views/custom.cshtml已經存在。

輸出窗口顯示了卸載,包裝CustomNuGet這樣的事情:

該項目/Plugins/CustomNuGet/CSS/custom.css不能在您的工作空間中找到。

無法在工作區中找到該項目/Plugins/CustomNuGet/Scripts/custom.js。

無法在工作區中找到該項目/Plugins/CustomNuGet/Views/custom.cshtml。

我已經使用命令行工具創建了一個自定義的Nuget包。該文件夾是這樣的:

/CustomNuGet 
    CustomNuGet.nuspec 
    CustomNuGet.0.1.1.nupkg 
    /content 
     /lib 
      CustomNuGet.dll 
     /Plugins 
      /Views 
       custom.cshtml 
      /Scripts 
       custom.js 
      /CSS 
       custom.css 

該規範文件是使用創建:nuget spec並在每個文件的根文件夾CustomeNuGet包nuget pack。這裏是spec文件:

<?xml version="1.0"?> 
    <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> 
    <metadata> 
     <id>CustomNuGet</id> 
     <version>0.1.1</version> 
     <authors>CustomNuGet</authors> 
     <owners>CustomNuGet</owners> 
     <requireLicenseAcceptance>false</requireLicenseAcceptance> 
     <description>CustomNuGet</description> 
     <tags>CustomNuGet</tags> 
     <references> 
      <reference file="CustomNuGet.dll" /> 
     </references> 
     <dependencies> 
      <dependency id="WebActivatorEx" version="2.0.0" /> 
     </dependencies> 
    </metadata> 
    <files> 
     <file src="content\lib\CustomNuGet.dll" target="lib"/> 
     <file src="content\Plugins\**" target="content\Plugins" /> 
    </files> 
    </package> 

我沒有看到關於這個確切問題,所以希望其他人遇到了這種情況發生的任何職位,這只是我錯過了設置。

+0

您的解決方案已鏈接到TFS源代碼管理是嗎? – Rhumborl 2015-01-15 16:36:13

+0

是的。我們的回購在TFS上。 – area28 2015-01-15 16:45:20

+0

您是否嘗試打開您在包中生成的.nupkg文件?這只是一個zip文件,所以像7-zip這樣的程序將會打開它(你也可以使用像[NuGet Package Explorer](http://npe.codeplex.com/)這樣的工具)。無論哪種方式,您都可以瀏覽軟件包並查看一切是如何佈置的,文件是否包含兩次或其他任何外觀不正確。 – NextInLine 2015-01-16 22:42:56

回答

1

如果您手動刪除.dll引用,而不是使用uninstall-package通過控制檯刪除它,則可能會發生這種情況。檢查packages.config文件,你試圖安裝的軟件包可能仍然在那裏列出。您將不得不從該配置文件中刪除它並保存更改。做完之後,再次嘗試安裝軟件包,它應該可以正常工作。