Get a Visual Studio project (MSBuild) to know the Team Build output location
I have this custom build step form my project:
<Target Name="BeforeBuild">
<WriteLinesToFile Condition="" File="$(OutputPath)\en开发者_如何学Pythonv.config"
Lines="$(Configuration)" Overwrite="true">
</WriteLinesToFile>
</Target>
Basically it outputs the build configuration to a file.
This works fine when building in Visual Studio. Team Build decided to make things harder. The OutputPathfor Team Build is in a different spot (not bin\$(Configuration))
I know how to find out if the build is part of a team build (Condition=" '$(TeamBuildConstants)' == '_TEAM_BUILD_' "
) but unless I want to hard code the path, I can't see a way to get the Team Build path.
Any ideas on how to find out (in the project, the the Team Build file) what the output location is?
You might need to use $(OutDir) when running in Team Build:
http://blogs.msdn.com/aaronhallberg/archive/2007/06/07/preserving-output-directory-structures-in-orcas-team-build.aspx
So you could use the _TEAM_BUILD_ condition and have two calls - one with OutputPath and one with OutDir.
精彩评论