views:

211

answers:

1

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?

A: 

Hi,

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
I just want do an import only if a specific target is being called etc... it doesn't appear you can do an import from within a target body either from what I can tell.
Jeremy T
Any thoughts on this Sayed?
Jeremy T
You can't do what you need unfortunately. But I've never run into a situation where I've had to do this. I think you may need to think about alternative approaches to your solution. This is why I was trying to inquiry to find more details about your specific situation.
Sayed Ibrahim Hashimi