SolutionDir macro in post build event

Hi, I have a project with a post build event that looks like:

copy $(SolutionDir)$(ProjectName)\$(OutDir)*.dll $(SolutionDir)DestFolder

My MSBuild file lookes like:

<Project DefaultTargets="Build"
xmlns=http://schemas.microsoft.com/developer/msbuild/2003>
<PropertyGroup>
<SolutionFile>MSBuildIssue.sln</SolutionFile>
</PropertyGroup>
<Target Name="Build">
<!-- Clean, then rebuild entire solution -->
<MSBuild Projects="$(SolutionFile)" Targets="Clean;Rebuild" />
</Target>
</Project>

when I run it from VStudio it works fine but when I try to build the project
from the command line using an msbuild project it seems that it can't
resolve the SoulutionDir macro (it desiplays as *Undefined*). here is the
the error I see:

Target PostBuildEvent:
copy*Undefined*SomeProject\bin\Debug\*.dll *Undefined*DestFolder
The filename, directory name, or volume label syntax is incorrect.
*Undefined*SomeProject\bin\Debug\*.dll
0 file(s) copied.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215Microsoft.Common.targets(3007,13):
error MSB3073: The command "copy *Undefined*SomeProject\bin\Debug\*.dll
*Undefined*DestFolder" exited with code 1.

Do you know what the issue could be?

Thanks

Gabo

[1417 byte] By [Gabo] at [2008-3-6]
# 1
For $(SolutionDir) to work, you have to build the solution from the command line, and not the individual project. This is because this property is not accessible when you are just building outside of the solution.

In Beta2, even building the solution might be problematic - however, this was fixed and building a solution should resolve this property correctly.

Will it be possible for you to try this on a June or July CTP build?

Thanks.
Faisal Mohamood
MSBuild Team

FaisalMohamood at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 2
Thanks for your reply, I'm using Beta 2 and I'm having trouble downloading the CTP (it seems the server is a bit overloaded), I'll let you know how it goes once I get my environment updated.

Gabo

Gabo at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...
# 3
Hi, I retried it with the July CTP and it works fine with that one.

Thanks

Gabo

Gabo at 2007-9-9 > top of Msdn Tech,Visual Studio,Visual Studio MSBuild...

Visual Studio

Site Classified