jtruelove
jtruelove

Reputation: 3396

MSBuild - Target Dependent Imports

I want to make an import dependent on which target I call MSBuild with from the commandline but I'm having a hard time figuring out how to programatically access the target name(s) the .proj file was called with

i.e. <Import Project="some.targets" Condition="$(TargetName) == myTarget"/>

In general is there a way to dump all defined environment variables that exist at proj file runtime?

Upvotes: 3

Views: 2000

Answers (1)

Sayed Ibrahim Hashimi
Sayed Ibrahim Hashimi

Reputation: 44332

Unfortunately I don't think that you can access the names of the targets specified on the command line from within the build script itself. What are you trying to do, maybe there is another approach you can take.

Sayed Ibrahim Hashimi

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

Upvotes: 3

Related Questions