Hi folks,
I have two questions re: visual studio 2008 and post-build events.
1) How do i dynamically list the msbuild.exe full path, to be called by the post-build event? Currently, i have the following (which works beautifully, btw):-
C:\Windows\Microsoft.NET\Framework64\v3.5\msbuild.exe
"$(ProjectDir)MSBuild\MSBuildSettings.xml"
.. but that would only work if u have a x64 bit environment. Is there a way to use some built in magic setting? eg. $(MsBuildPath)msbuild.exe "blah....xml"
??
2) My msbuild task does some stuff then generates a txt file as the output. I define the output path in the msbuild xml file as such..
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/MsBuild/2003">
<UsingTask TaskName="CustomTask" AssemblyFile="MyAssembly.dll"/>
<Target>
<CustomTask
...
OutputFile="Foo.txt"
/>
<Target>
</Project>
How can i pass in the real output folder, to the msbuild file? I tried...
OutputFile="$(OutDir)Foo.txt"
but that failed :(
Cheers!
Update #1 - Answer to the second question..
I've figured out a way to answer the second question -- not sure if it's the best one though .. so I'm open to other ideas :)
XML file changes :: add a property group that sets the internal variable name IF no outside arguments were passed to the msbuild.exe executable.
<PropertyGroup>
<OutputFile Condition=" '$(OutputFile)'=='' ">
..\SomeFolder\Foo.txt</OutputFile>
</PropertyGroup>
<Target>
<CustomTask
...
OutputFile="$(OutputFile)"
/>
<Target>
</Project>
Now, call the msbuild executable like ...
msbuild.exe "C:\Temp Foo\Blah\MsbuildSettings" /p:OutputFile="C:\Folder 1\Folder 2\blah\"
and that works :)