How to fix Azure DevOps error MSB4126


Setting up build and release pipeline always tedious and we face many build related issues. Here is one common error I face couple of times while setting app Web or windows apps in Azure DevOps

After placing the code in repos, and creating the build pipeline and run it, you can face the following error

##[error]D:\a\8\s\<your solution file>.sln.metaproj(0,0): Error MSB4126: The specified solution configuration "release|$(BuildPlatform)" 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.


To understand what is target platform defined in your project you need to visit or open the solution(.sln) file and review the following sections. In my case, this has been defined as x86 as target platform.

                  GlobalSection(SolutionConfigurationPlatforms) = preSolution
                  EndGlobalSection

                  GlobalSection(ProjectConfigurationPlatforms) = postSolution
                  EndGlobalSection

After reviewing this, I went ahead and created pipeline variable ‘platform’ and place the value x86. However, that doesn’t help me anyway.




I moved to build solution task on the agent job and put x86 under Platform text box.




Next, save and queue. Boom! It got success J





Enjoy DevAops!


Comments

  1. Great share!

    you have outdone yourself this time Thank you for this informative post. it's really helped me. looking more for your side @
    Development and Operations Services

    ReplyDelete

Post a Comment

Popular posts from this blog

How to create Custom Visuals in Power BI – Initial few Steps

How to fix Azure DevOps Error CS0579