2

I am new to Azure and I have inherited a pipeline which was built by someone else who is no longer with the company. It's broken in many ways, so I am attempting to build a new one based on the original broken one I was given. I am doing this one command at a time to fix the issues as i go. Currently the following task is failing:

- task: VSBuild@1
    displayName: Build Solution
    inputs:
      solution: $(BuildParameters.solution)
      msbuildArgs: /p:DeployOnBuild=true /p:WebPublishingMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\$(BuildConfiguration)\\"
      platform: $(BuildPlatform)
      configuration: $(BuildConfiguration)

I have researched other similar stack overflow posts but still can't figure out what the issue is. The warning I am receiving is this:

Warning MSB4126: The specified solution configuration "$(BuildConfiguration)|$(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.

Here is what I have tried so far:

  1. I tried removing both the platform and configuration settings (the last two lines of the first quoted code above). This resulted in 54 other warnings so that seemed like a bad idea.

  2. next I put those two lines back in that I had deleted and instead i added this: /p:Configuration=Debug /p:Platform="Any CPU" to the very begining of the parameter string listed on the msbuildArgs setting. This got rid of the 54 new warnings and brought back the original error (in other words it had no effect)

Also this other stack overflow question: TFS Build error MSB4126 (solution configuration is invalid) how to fix seems to have an a solution for this, however I can't figure out how to actually apply this solution. There is a screenshot of the Azure UI in that ticket and I can't even figure out how to get to that page of Azure to see those options. My guess is that this person is not using a yaml file to set up the pipeline and doing it the old way, but I do not want to configure it that way because I would prefer to have the yaml file define the pipeline and have this stored in my git repo.

Note: I have also been looking at the sln file associated with this project to try to make sense out of it, I think I get the basic idea of this file not sure...

Any advice will help, thanks

Dallas Caley
  • 5,367
  • 6
  • 40
  • 69
  • Yes your answer is helpful, unfortunately I haven't had the ability to check it yet. The code in question is C# .NET and i have never coded in that. The suggestion from my co-worker was to set up Visual Studio Pro so that I could test the builds locally so that is what i've been focusing on. Also I have no idea what those two variables would be for this particular set of code. I'll mark it as correct for now, but i may add to the answer once i actually get it working. – Dallas Caley Feb 23 '21 at 04:39

2 Answers2

3

It looks like there two variables aren't defined:

$(BuildConfiguration)
$(BuildPlatform)

Make sure the variables are defined in your pipeline yaml or on the variables tab.

See:

Set the values to the ones that make sense for the solution. We can't guess these values, as they are usually specific to the solution being built.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
0

Here the steps :-

  1. Go to Azure Devops Pipeline where you have created your Pipeline.
  2. Click on Edit pipeline using 3 dots visible for every pipeline you create.
  3. Now Click on variables.
  4. Leave BuildConfiguration and BuildPlatform blank (It will automatically pick based on your configuration in code).
  5. Save and Run Queue.

Note:- This will only help if you have created your pipeline via classic method and not YAML. I am not able to add images as it requires minimum 10 points. As soon as I get those points will add images for each step.

Chaudhary
  • 1
  • 1