1
votes

I had setup the devops flow for one of my client application. It’s woking fine in build and release level. But after some days suddenly my build failed with the following error.

node_modules\uws\build\binding.sln.metaproj(0,0): Error MSB4126: The specified solution configuration "release|any cpu" 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.

enter image description here

Can anyone please tell me how to resolve this issue?

3
What's the type of your project? Is it website app?Marina Liu
@Marina, Yes, it is an Angualr2 application.Pradeep
What if you change to **\*.publishproj instead of **\*.sln in VS Build task?Marina Liu
@MarinaLiu-MSFT, Thanks you helped a lot for me, but i did mistake in the VS Build Task i.e I used the ***.sln in the VS build task instead using .sln (for example InnovationApp.sln).Pradeep
Sure. For VS Build task, you should specify solution by path/to/name.sln or **\*.sln. I use .sln just stand for the solution file.Marina Liu

3 Answers

1
votes

You can use PowerShell tasks to change the .sln file.

Assume if you want to build projects except a website project, then you can remove the website project info in GlobalSection of the .sln file.

Prerequisites:

Get the project ID you want to remove, the formate as ECF93D95-5096-497E-B4B8-83416DABB516.

Then add a PowerShell task before VS build task which build other projects. The script as:

git checkout $(BUILD.SOURCEBRANCHNAME)
(get-content "$(Build.SourcesDirectory)\relative\path\to\solution") -notmatch "{project_ID}.$(BuildConfiguration)" | out-file "$(Build.SourcesDirectory)\relative\path\to\solution"

Such as below example to remove the project ECF93D95-5096-497E-B4B8-83416DABB516 from .sln file:

git checkout $(BUILD.SOURCEBRANCHNAME)
(get-content "$(Build.SourcesDirectory)\ConsoleAppCore\ConsoleAppCore.sln") -notmatch "{ECF93D95-5096-497E-B4B8-83416DABB516}.$(BuildConfiguration)" | out-file "$(Build.SourcesDirectory)\ConsoleAppCore\ConsoleAppCore.sln"

After the VS Build task, you can add another PowerShell task to recovery the changed .slnas the same version in git repo. The script as:

git reset --hard head

For building websit project except other projects, you can use the same way to skip the project for building.

Note: for PowerShell task, please deselect Fail on Standard Error option.

enter image description here

0
votes

I think the best option is to use multiple solutions which target group of projects together (Partitioned Solution) Here is link to get more info about it

Partitioned Solution

Also I implement in many open source project, here one of them

Project on GitHub using Partitioned Solution enter image description here

0
votes

I had this problem once while using VSTS. I suggest you to use MSBuild arguments directly

Ho to add to MSBuild Arguments:

/p:Configuration=$(BuildConfiguration) /p:Platform="$(BuildPlatform)"

Note: leave Platform and Configuration empty