Reputation: 83
I have a solution with an web api project and a blazor webassembly project. If I create a pipeline to create an artifact for release, it all works great untill I visit the domain where I can only visit my blazor webassembly project. How am I able to access the api?
azure pipeline:
# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core
# trigger:
# - master
pool:
vmImage: 'windows-2022'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'BackEndRelease'
steps:
- task: UseDotNet@2
displayName: Use .NET 6.0
inputs:
packageType: 'sdk'
version: '6.0.x'
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
I use the artifact to create a release pipeline. I even created my own build configuration (BackEndRelease) where I unchecked the blazor project, but it doesn't change anything.
Upvotes: 1
Views: 1219
Reputation: 35249
Based on your requirement, you need to specify the API project in Solution file.
You can add msbuild argument in the VSBuild task.
Here are the steps:
1.Check the target Project name in Solution file.
For example:
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{497AD76F-222C-4BEB-BDCB-401B0E80B5CE}"
2.Add the target argument in VSbuild. /t:test
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site" /t:test'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
Upvotes: 1