1
votes

I have Service Fabric based system created and working on production environment (and development). Everything is ok. Now I was trying to setup CI on Visual Studio Team Services with provided templates for ASF projects. Unfortunately my system has Actors (.NET 4.5.2) and WebAPI based on ASP.NET Core 1.1. I have references to Actor interfaces project (also .NET 4.5.2) forom .NET Core.

When I'm trying to build project with default template I'm recieving error because dotnet restore was not run. Ok, so I've added step to run dotnet restore but then I'm getting error complaining that it cannot find reference to Actor.Interfaces.

dotnet restore also fails on my dev machine but solution build with VS goes ok.

How can I fix this issue?

[UPDATE]

Thanks Mardoxx, I've made some progress... now I'm getting below error for *.sln buld. My solution is VS2015 (set in build task), I've set env to Hosted 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]

After taking steps presented by starain-MSFT I'm getting errors during 'dotnet restore':

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]

Another update after @starain input.

Now I'm getting error that references (to .NET 4.5.2 projcects from Core projects) could not be found.

        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
1
Make sure your build environment is VS2017! For hosted machines: visualstudio.com/en-us/docs/build/concepts/agents/…Mardoxx
You also need to add a build task that does msbuild /t:restore for the service fabric project to pull its dependencies- new csproj format is not supported yet so it still uses old methods (afaik).Mardoxx
Thanks, I've updated my question.michajas
If you are still using VS2015 and xproj for your .net core, I don't think you can use the VS2017 hosted agent. Try going back to VS2015 and build the actor project first, then do dotnet restore then build the solution.Mikkel Mørk Hegnhøj

1 Answers

2
votes

Refer to these steps below:

  1. Create a new build definition with Azure Service Fabric Application template
  2. Change Visual Studio Version to Visual Studio 2015 for Visual Studio Build steps.
  3. Select NuGet Installer step/task, change NuGet version to 3.5.0 in Advanced section.
  4. Select Options tab and change Default agent queue to Hosted
  5. Queue build with Hosted agent. (Not Hosted VS 2017)

All build steps:

  1. NuGet Installer (NuGet restore ***.sln)
  2. .Net Core (dotnet restore)
  3. Visual Studio Build (Build solution ***.sln)
  4. Visual Studio Build (Build solution ***.sfproj)
  5. Copy Files
  6. Delete files
  7. Update Service Fabric App Versions
  8. Copy Files
  9. Publish Build Artifacts