user25470
user25470

Reputation: 595

convert devenv parameters to msbuild parameters

I am migrating a few solutions into azure devops and want to use the MSBuild Task to build them.

The are currently build using devenv with the following commands:

devenv.com file.vcxproj /rebuild "unittest debug" /project project_name

I thought I would try with

msbuild.exe file.vcxproj /p:Project=project_name /p:configuration="unittest debug"

But I am getting the error that the project does not contains the "unittest debug"

I would appreaciate any help I could get.

Thanks for reading,

Upvotes: 0

Views: 229

Answers (1)

Jonathan Dodds
Jonathan Dodds

Reputation: 5008

The devenv command line you are using doesn't make complete sense.

file.vcxproj is a C++ project. If it were a solution, e.g. somesolution.sln, then the /project switch would make sense, e.g. if somesolution.sln included file.vcxproj then the following command would build file.vcxproj.

devenv.com somesolution.sln /project file

Solutions and projects have a 'configuration' and a 'platform'. "unittest debug" looks like an attempt to specify this information but the syntax is not correct. The correct syntax is

<configuration>|<platform>

The default configuratuion values are Debug and Release.

I suspect that

"unittest debug"

should be

"debug|unittest".

The original devenv command line can probably be rewritten as

devenv.com file.vcxproj /rebuild "debug|unittest"

The MSBuild equivalent is

msbuild.exe file.vcxproj /t:rebuild /p:configuration=debug;platform=unittest

The /build, /clean, and /rebuild switches on devenv map to MSBuild targets in the C++ project. The C++ project also expects configuration and platform as separate properties.

Upvotes: 2

Related Questions