I have a .NET Core 3.1 API that I am attempting to deploy as a Guest Executable in Service Fabric using an Azure DevOps build pipeline. The platform for all projects/configurations is x64.
I have locally tested the API and also locally tested the API running as a guest executable within service fabric. I am able to build/rebuild the API and I am able to package the service fabric application.
In my build pipeline, I have the following steps shown in the picture below.
The Create Service Fabric Package is defined in the picture below
When the build pipeline runs, it always fails with the error:
##[error]AppraisalStatusUpdatesContainer\AppraisalStatusUpdatesContainer.sfproj(0,0): Error MSB4057: The target "Package" does not exist in the project.
I cannot find any documentation on what to do to solve this issue and have spent a couple of days trying. Does anyone know how to get this to work?
Edit 1
The sfproj is provided below
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.10\build\Microsoft.VisualStudio.Azure.Fabric.Application.props" Condition="Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.10\build\Microsoft.VisualStudio.Azure.Fabric.Application.props')" />
<PropertyGroup Label="Globals">
<ProjectGuid>ffefa7ed-cf72-4780-9910-816deed2ed4f</ProjectGuid>
<ProjectVersion>2.5</ProjectVersion>
<MinToolsVersion>1.5</MinToolsVersion>
<SupportedMSBuildNuGetPackageVersion>1.6.10</SupportedMSBuildNuGetPackageVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<None Include="ApplicationPackageRoot\ApplicationManifest.xml" />
<None Include="ApplicationParameters\Prod.xml" />
<None Include="ApplicationParameters\QA.xml" />
<None Include="ApplicationParameters\UAT.xml" />
<None Include="ApplicationParameters\Local.1Node.xml" />
<None Include="ApplicationParameters\Local.5Node.xml" />
<None Include="PublishProfiles\QA.xml" />
<None Include="PublishProfiles\UAT.xml" />
<None Include="PublishProfiles\Prod.xml" />
<None Include="PublishProfiles\Local.1Node.xml" />
<None Include="PublishProfiles\Local.5Node.xml" />
<None Include="Scripts\Deploy-FabricApplication.ps1" />
</ItemGroup>
<ItemGroup>
<Content Include="..\AppraisalStatusUpdates\bin\Release\netcoreapp3.1\publish\**\*.*">
<Link>ApplicationPackageRoot\AppraisalStatusUpdatesContainerPkg\Code\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Content>
<Content Include="ApplicationPackageRoot\AppraisalStatusUpdatesContainerPkg\Config\Settings.xml" />
<Content Include="ApplicationPackageRoot\AppraisalStatusUpdatesContainerPkg\ServiceManifest.xml" />
<Content Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<PropertyGroup>
<ApplicationProjectTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Service Fabric Tools\Microsoft.VisualStudio.Azure.Fabric.ApplicationProject.targets</ApplicationProjectTargetsPath>
</PropertyGroup>
<Import Project="$(ApplicationProjectTargetsPath)" Condition="Exists('$(ApplicationProjectTargetsPath)')" />
<Import Project="..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.10\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.10\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets')" />
<Target Name="ValidateMSBuildFiles" BeforeTargets="PrepareForBuild">
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.10\build\Microsoft.VisualStudio.Azure.Fabric.Application.props')" Text="Unable to find the '..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.10\build\Microsoft.VisualStudio.Azure.Fabric.Application.props' file. Please restore the 'Microsoft.VisualStudio.Azure.Fabric.MSBuild' Nuget package." />
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.10\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets')" Text="Unable to find the '..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.10\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets' file. Please restore the 'Microsoft.VisualStudio.Azure.Fabric.MSBuild' Nuget package." />
</Target>
</Project>
Edit 2 @LeoLiu-MSFT, I have attempted the approach you mentioned. I am not getting the original error, but am now attempting to resolve the subsequent issues that resulted. Also, I am doing dotnet publish and dotnet test tasks before this step. It seems like the publish step is unnecessary except that it is needed for running the tests.
My msbuild step is now as follows
This results in the exception below:
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(777,5): Error : The OutputPath property is not set for project 'AppraisalStatusUpdatesContainer.sfproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Release' Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project.