2017-05-20 23 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

相关问题