2017-07-04 137 views
1

我有幾個項目用asp.net核心,我想出口到NuGet。第一個版本(0.9.0)一切正常。但是當我將軟件包更新到0.9.1時,我開始出現版本問題,導致應用程序開始尋找0.9.1版本的所有依賴項(即使只更新了其中一個,其他版本仍保持在0.9.0)asp.net核心nuspec項目依賴

任何人都可以檢查我的配置,看看我在哪裏犯我的錯誤? 謝謝!

這是我得到的錯誤:

FileLoadException: Could not load file or assembly 'Framework.Web, Version=0.9.1.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 

FileLoadException: Could not load file or assembly 'Framework.Web, Version=0.9.1.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 

這是我nuspec文件:

<?xml version="1.0" encoding="utf-8"?> 
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> 
    <metadata> 
    <!-- Required elements--> 
    <id>Framework.Web.Mvc</id> 
    <version>0.9.1</version> 
    <description>Framework web MVC library</description> 
    <authors>Lucas Leite</authors> 

    <!-- Optional elements --> 
    <dependencies> 
     <dependency id="Framework.Web" version="0.9.0" /> 
     <dependency id="Framework.Model" version="0.9.0" /> 
     <dependency id="Microsoft.AspNetCore.Localization.Routing" version="1.1.2" /> 
     <dependency id="Microsoft.AspNetCore.Mvc" version="1.1.3" /> 
    </dependencies> 
    <!-- ... --> 
    </metadata> 
    <!-- Optional 'files' node --> 
    <files> 
    <file src="bin\Release\netcoreapp1.1\Framework.Web.Mvc.dll" target="lib\netcoreapp1.1" /> 
    <file src="bin\Release\netcoreapp1.1\Framework.Web.Mvc.xml" target="lib\netcoreapp1.1" /> 
    <file src="bin\Release\netcoreapp1.1\pt-BR\Framework.Web.Mvc.resources.dll" target="lib\netcoreapp1.1\pt-BR" /> 
    </files> 
</package> 

回答

1

嘗試依賴的版本改爲(,0.9.0]

<dependency id="Framework.Web" version="(,0.9.0]" /> 

因此到Nuget dependency versioning

<!-- Accepts any version 0.9.0 and above --> 
<dependency id="Framework.Web" version="0.9.0" /> 

<!-- Accepts any version up below or include 0.9.0--> 
<dependency id="ExamplePackage" version="(,0.9.0]" /> 
+0

善良的上帝,謝謝。 –

相關問題