2014-01-28 27 views
1

我在Visual Studio中有一個項目,並且我已經設置爲true來構建。Nuget Pack在我的項目中出現錯誤的依賴關係

我packages.config看起來像這樣

<packages> 
    <package id="Microsoft.AspNet.Identity.Core" version="1.0.0" targetFramework="net45" /> 
    <package id="Microsoft.AspNet.Identity.Owin" version="1.0.0" targetFramework="net45" /> 
    <package id="Microsoft.Owin" version="2.1.0" targetFramework="net45" /> 
    <package id="Microsoft.Owin.Security" version="2.1.0" targetFramework="net45" /> 
    <package id="Microsoft.Owin.Security.Cookies" version="2.1.0" targetFramework="net45" /> 
    <package id="Microsoft.Owin.Security.Facebook" version="2.1.0" targetFramework="net45" /> 
    <package id="Microsoft.Owin.Security.Google" version="2.1.0" targetFramework="net45" /> 
    <package id="Microsoft.Owin.Security.MicrosoftAccount" version="2.1.0" targetFramework="net45" /> 
    <package id="Microsoft.Owin.Security.OAuth" version="2.1.0" targetFramework="net45" /> 
    <package id="Microsoft.Owin.Security.Twitter" version="2.1.0" targetFramework="net45" /> 
    <package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" /> 
    <package id="Owin" version="1.0" targetFramework="net45" /> 
</packages> 

,但返回的nupkg具有以下依存關係結束了。

<dependencies> 
    <dependency id="Microsoft.AspNet.Identity.Owin" version="1.0.0" /> 
    <dependency id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" /> 
    <dependency id="Microsoft.Owin.Security.Facebook" version="2.1.0" /> 
    <dependency id="Microsoft.Owin.Security.Google" version="2.1.0" /> 
    <dependency id="Microsoft.Owin.Security.MicrosoftAccount" version="2.1.0" /> 
    <dependency id="Microsoft.Owin.Security.Twitter" version="2.1.0" /> 
</dependencies> 

在Visual Studio如見於packages.config我有一個參考Microsoft.Owin.Security.OAuth 2.1.0和Microsoft.AspNet.Identity.Owin具有其依賴設爲> 2.0.0所以我想知道如何將Microsoft.Owin.Security.OAuth忽略爲我的包依賴關係。

這會導致我的部署失敗,因爲它取得2.0的oauth而不是2.1,因爲我的軟件包依賴於它。

這是它應該如何工作?

回答

0

Visual Studio已經基於它提供的信息滿足軟件包依賴關係(如您所見,選擇版本2.0.0)。你可以更具體的瞭解,你需要通過使用packages.configallowedVersions屬性,在這種情況下包版本,設置

<package id="Microsoft.Owin.Security.OAuth" version="2.1.0" allowedVersions="[2.1,3)" targetFramework="net45" /> 

指定使用至少Microsoft.Owin 2.1.0版本。 Security.OAuth,但也可能是2.2.x和高達2.9.y,而不是3.0

威力造成不兼容Microsoft.AspNet.Identity.Owin,不過,這將需要單獨解決。

+0

咋,我手動添加更多的信息到我的package.config並添加了程序集綁定和東西的工作。 –

+0

我很高興這有幫助 –