2016-09-13 82 views
17

我已經得到了當地建立了一個解決方案,我創建了一個新的版本,並增加了一個步驟,它無法解析錯誤,當嘗試DOTNET恢復多項目解決方案

dotnet restore 

我得到這個錯誤消息:

... OTHER SUCCESSFUL INSTALLATIONS ... 
    log : Installing Microsoft.Extensions.FileProviders.Abstractions 1.0.0. 
    log : Installing Microsoft.Extensions.Configuration.Abstractions 1.0.0. 
    log : Installing Microsoft.Extensions.DependencyInjection.Abstractions 1.0.0. 
    log : Writing lock file to disk. Path: C:\a\1\s\Wedding.WebApp\project.lock.json 
    log : C:\a\1\s\Wedding.WebApp\project.json 
    log : Restore failed in 13722ms. 
    Errors in C:\a\1\s\Wedding.WebApp\project.json 
     Unable to resolve 'Wedding.Application' for '.NETFramework,Version=v4.6.1'. 
     Unable to resolve 'Wedding.Common' for '.NETFramework,Version=v4.6.1'. 
     Unable to resolve 'Wedding.WebApp.Setup' for '.NETFramework,Version=v4.6.1'. 

它引用了我的主要Web項目引用的三個其他項目。

這是我project.json

{ 
     "dependencies": { 
     "Microsoft.AspNetCore.Diagnostics": "1.0.0", 
     "Microsoft.AspNetCore.Mvc": "1.0.1", 
     "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
     "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", 
     "Microsoft.AspNetCore.StaticFiles": "1.0.0", 
     "Microsoft.Extensions.Configuration.Json": "1.0.0", 
     "Microsoft.Extensions.Logging.Console": "1.0.0", 
     "Microsoft.Extensions.Logging.Debug": "1.0.0" 
     }, 

     "tools": { 
     "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", 
     "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final" 
     }, 

     "frameworks": { 
     "net461": { 
      "dependencies": { 
      "Wedding.Application": { 
       "target": "project" 
      }, 
      "Wedding.Common": { 
       "target": "project" 
      }, 
      "Wedding.WebApp.Setup": { 
       "target": "project" 
      } 
      } 
     } 
     }, 

     "buildOptions": { 
     "emitEntryPoint": true, 
     "preserveCompilationContext": true 
     }, 

     "publishOptions": { 
     "include": [ 
      "wwwroot", 
      "web.config" 
     ] 
     }, 

     "scripts": { 
     "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] 
     } 
    } 

有誰知道爲什麼會被示數?

+0

作爲一項主要工作,我發現我需要創建一個新的WebApp和一個新項目。然後,我將代碼逐個移植到將它發佈到新的WebApp的新項目中。每次檢查發佈後確定。在移植所有內容之後,我不知道是什麼導致了這一點,但是現在我可以通過右鍵單擊該項目進行發佈。 – chris31389

+0

我找到了同樣的東西。一個惱人的解決方法,但至少它擺脫了錯誤。 – Alyce

+0

您是否嘗試將'net461'下的依賴關係移動到'dependencies'節點下的位置? – Deilan

回答

0

基於this回答同一個問題:

換上.NET核心類庫項目。它爲我工作。

1

dependenciesframeworks塊顯示不正確對我說:我預計要在dependencies塊,而不是frameworks塊中聲明你所依賴的庫。它通常更類似於此,對於參考另一個項目的一個項目:

{ 

    "dependencies": { 
    "Microsoft.AspNetCore.Diagnostics": "1.0.0", 
    "Microsoft.AspNetCore.Mvc": "1.0.1", 
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", 
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", 
    "Microsoft.AspNetCore.StaticFiles": "1.0.0", 
    "Microsoft.Extensions.Configuration.Json": "1.0.0", 
    "Microsoft.Extensions.Logging.Console": "1.0.0", 
    "Microsoft.Extensions.Logging.Debug": "1.0.0", 
    "Wedding.Application": { "target": "project" }, 
    "Wedding.Common": { "target": "project" }, 
    "Wedding.WebApp.Setup": { "target": "project" } 
    }, 

    "frameworks": { 
    "net461": { 
     "imports": [] 
    } 
    }, 

    ... 
} 
0

我得到了相似的問題。通過在解決方案文件中手動交換項目訂單來解決此問題

Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Some.Lib", "..\Some\Path\SomeProject.csproj", "{B539B811-6E75-48E0-A679-9F7092CC0261}" 
EndProject 
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Some.Web.App", "SomePath\WebApplication3.csproj", "{244C097B-B6FD-4995-AAE3-87AB1748EA38}" 
EndProject 

Lib是.NetStandard 1.1和Web.App上的.NetFramework 4.6 Core 1.0。

默認的項目順序不適用於我。交換完所有罰款後。

相關問題