I was working on migrating a website to a web project, I updated the project and everything is fine locally, I've switched to building the solution instead of the project. But when building on the build server, I'm getting an error message
c:\agent_work\10\s\mySolution.sln.metaproj(0,0): Error MSB4126: The specified solution configuration "Debug|AnyCPU" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.
What is wrong and more importantly, what do I do to fix it?
For Azure DevOps Server 2020, add a variable to your azure-pipelines.yml file before the steps.
variables:
buildConfiguration: 'Debug'
Example use:
- task: DotNetCoreCLI@2
displayName: 'Building Projects'
inputs:
command: 'build'
projects: '$(Build.SourcesDirectory)/**/*.sln'
arguments: '--configuration $(buildConfiguration)'
The problem is simple as indicated in the error message. The configuration name does not match any of the configurations defined in the solution.
The solution is likewise simple: either create a configuration that matches the name and add it to your solution, or change the configuration name being used to build the application. The build solution step has textbox where you enter the BuildPlatform, the content is $(BuildPlatform)
. The value for that is set in the Variables section. In this case it needs to be changed from "AnyCPU" to "Any CPU" (i.e. add a space between Any and CPU).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With