2017-05-20 21 views
1

我有基於Service Fabric的系統創建並正在開發生產環境(和開發)。一切都好。現在我試圖在Visual Studio Team Services上爲提供的ASF項目模板設置CI。 不幸的是我的系統有Actors(.NET 4.5.2)和基於ASP.NET Core 1.1的WebAPI。我引用了.NET接口項目(也是.NET 4.5.2)for .NET Core。Azure服務結構無法在ASP.NET核心的VSTS上執行CI

當我嘗試使用默認模板構建項目時,我收到錯誤,因爲沒有運行dotnet恢復。好吧,我已經添加了一步來運行dotnet恢復,但後來我收到錯誤抱怨說它找不到對Actor.Interfaces的引用。

dotnet恢復也在我的開發機器上失敗,但VS解決方案構建成功。

我該如何解決這個問題?

[更新]

感謝Mardoxx,我已經取得了一些進展......現在我得到以下錯誤*的.sln球泡。我的解決方案是VS2015(在構建任務中設置),我已將env設置爲託管VS2017。

IntegrationApi\IntegrationApi.xproj(7,11): Error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\DotNet\Microsoft.DotNet.Props" was not found. Also, tried to find "DotNet\Microsoft.DotNet.Props" in the fallback search path(s) for $(VSToolsPath) - "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0" . These search paths are defined in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\msbuild.exe.Config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths. 
Project "d:\a\1\s\Labelcall.sln" (1) is building "d:\a\1\s\IntegrationApi\IntegrationApi.xproj" (18) on node 1 (default targets). 
d:\a\1\s\IntegrationApi\IntegrationApi.xproj(7,11): error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0\DotNet\Microsoft.DotNet.Props" was not found. Also, tried to find "DotNet\Microsoft.DotNet.Props" in the fallback search path(s) for $(VSToolsPath) - "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0" . These search paths are defined in "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\msbuild.exe.Config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths. 
Done Building Project "d:\a\1\s\IntegrationApi\IntegrationApi.xproj" (default targets) -- FAILED. 

[UPDATE2]

'期間的dotnet恢復' 以我得到錯誤的starain-MSFT呈現步驟後:

log : Restoring packages for d:\a\1\s\AdminPanel\project.json... 
error: Unable to resolve 'AccountActor.Interfaces' for 
'.NETFramework,Version=v4.5.2'. 
error: Unable to resolve 'CommonContracts' for 
'.NETFramework,Version=v4.5.2'. 
error: Unable to resolve 'CommonInfrastructure' for 
'.NETFramework,Version=v4.5.2'. 

[UPDATE3]

@starain輸入後的另一個更新。

現在我收到錯誤,無法找到引用(對於來自核心項目的.NET 4.5.2項目)。

 Project "d:\a\1\s\LabelcallApplication\LabelcallApplication.sfproj" (2) is building "d:\a\1\s\MobileApi\MobileApi.xproj" (19) on node 1 (default targets). 
    PrepareForBuild: 
     Creating directory ".\bin\". 
     Creating directory ".\obj\Release\". 
    PreComputeCompileTypeScript: 
     C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe --noEmitOnError --listEmittedFiles 
    CompileTypeScript: 
     C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe --noEmitOnError --listEmittedFiles 
    CoreCompile: 
     C:\Program Files\dotnet\dotnet.exe build "d:\a\1\s\MobileApi" --configuration Release --no-dependencies 
     Project MobileApi (.NETFramework,Version=v4.5.2) will be compiled because expected outputs are missing 
     Compiling MobileApi for .NETFramework,Version=v4.5.2 
     C:\Program Files\dotnet\dotnet.exe compile-csc @d:\a\1\s\MobileApi\obj\Release\net452\dotnet-compile.rsp returned Exit Code 1 
    MobileApi\project.json(6,44): Warning NU1012: Dependency conflict. Microsoft.ApplicationInsights.DependencyCollector 2.2.0 expected Microsoft.ApplicationInsights 2.2.0 but received 2.3.0 
    d:\a\1\s\MobileApi\project.json(6,44): warning NU1012: Dependency conflict. Microsoft.ApplicationInsights.DependencyCollector 2.2.0 expected Microsoft.ApplicationInsights 2.2.0 but received 2.3.0 [d:\a\1\s\MobileApi\MobileApi.xproj] 
    MobileApi\project.json(6,44): Warning NU1012: Dependency conflict. Microsoft.ApplicationInsights.PerfCounterCollector 2.2.0 expected Microsoft.ApplicationInsights 2.2.0 but received 2.3.0 
    d:\a\1\s\MobileApi\project.json(6,44): warning NU1012: Dependency conflict. Microsoft.ApplicationInsights.PerfCounterCollector 2.2.0 expected Microsoft.ApplicationInsights 2.2.0 but received 2.3.0 [d:\a\1\s\MobileApi\MobileApi.xproj] 
    MobileApi\project.json(6,44): Warning NU1012: Dependency conflict. Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.2.0 expected Microsoft.ApplicationInsights 2.2.0 but received 2.3.0 
    d:\a\1\s\MobileApi\project.json(6,44): warning NU1012: Dependency conflict. Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 2.2.0 expected Microsoft.ApplicationInsights 2.2.0 but received 2.3.0 [d:\a\1\s\MobileApi\MobileApi.xproj] 
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): Error : d:\a\1\s\MobileApi\error CS0006: Metadata file 'd:\a\1\s\ContactActor.Interfaces\bin\Release\ContactActor.Interfaces.dll' could not be found 
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : d:\a\1\s\MobileApi\error CS0006: Metadata file 'd:\a\1\s\ContactActor.Interfaces\bin\Release\ContactActor.Interfaces.dll' could not be found [d:\a\1\s\MobileApi\MobileApi.xproj] 
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): Error : d:\a\1\s\MobileApi\error CS0006: Metadata file 'd:\a\1\s\DeviceActor.Interfaces\bin\Release\DeviceActor.Interfaces.dll' could not be found 
    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : d:\a\1\s\MobileApi\error CS0006: Metadata file 'd:\a\1\s\DeviceActor.Interfaces\bin\Release\DeviceActor.Interfaces.dll' could not be found [d:\a\1\s\MobileApi\MobileApi.xproj] 
     Compilation failed. 
      3 Warning(s) 
      2 Error(s) 
     Time elapsed 00:00:01.7675632 
+0

確保您的構建環境是VS2017!對於託管機器:https://www.visualstudio.com/en-us/docs/build/concepts/agents/hosted#hosted-vs2017 – Mardoxx

+0

您還需要添加一個爲'msbuild/t:restore'生成的構建任務服務結構項目拉取其依賴關係 - 新的csproj格式尚不受支持,因此它仍使用舊方法(afaik)。 – Mardoxx

+0

謝謝,我已經更新了我的問題。 – michajas

回答

2

請參閱以下這些步驟:

  1. 創建Azure的服務織物應用模板
  2. 更改的Visual Studio版本創建新的構建定義爲Visual Studio打造步驟Visual Studio的2015年。
  3. 選擇NuGet安裝程序步驟/任務,將NuGet版本更改爲3.5.0,高級部分。
  4. 選擇選項選項卡並將默認代理隊列更改爲託管
  5. 使用託管代理隊列構建隊列。 (沒有託管VS 2017)

所有構建步驟:

  1. 的NuGet安裝程序(的NuGet恢復*** SLN)
  2. 對.NET核心(DOTNET恢復)
  3. 的Visual Studio生成(構建解決方案***。sln)
  4. Visual Studio Build(構建解決方案***。sfproj)
  5. 複製文件
  6. 刪除文件
  7. 更新服務織物應用版本
  8. 複製文件
  9. 發佈構建構件
+0

不幸的是,在dotnet恢復過程中出現錯誤(請參閱更新後的問題) – michajas

+0

@michajas改爲使用NuGet 3.5.0版本。 (刪除.Net Core步驟/任務,我更新了我的答案) –

+0

現在好了(我認爲)。查看更新的問題。 – michajas

相關問題