VS 2005 "Web Deployment Projects" wdproj lacks macros?

D

DBxGlock

I'm trying to create the equivalent of a post build event for a
website. I have the "Web Deployment Projects" add-in installed and am
attempting to follow the instructions in the "Using Web Deployment
Projects with Visual Studio 2005" document. In the "Customizing Web
Deployment Projects" section, it gives an example of an "AfterBuild"
target where a directory is created using the $(TargetDir) macro. When
I attempt to use $(TargetDir), it doesn't seem to exist. The only
macros I can find that work within the .wdproj file are solution level
(SolutionPath, SolutionDir, etc). What I really need are TargetDir,
ProjectDir, and ConfigurationName (to determine if we're compiling in
Debug or Release mode).

I have attempted using several of the macros available in standard
project post build events like this:

<Target Name="AfterBuild">
<Message Importance="high" Text="SolutionDir: $(SolutionDir)" />
<Message Importance="high" Text="ProjectDir: $(ProjectDir)" />
<Message Importance="high" Text="TargetDir: $(TargetDir)" />
<Message Importance="high" Text="OutDir: $(OutDir)" />
<Message Importance="high" Text="ConfigurationName:
$(ConfigurationName)" />
</Target>

The only one of these that works is $(SolutionDir). Does anybody know
why these aren't available in my .wdproj file and how I can get this
information? Most important is the Configuration being compiled.

Thanks,
Dan
 
J

Juan T. Llibre

Hi, DBxGlock.

I'm not sure if many people here are using the tool yet.

Scott Guthrie asked that, if you run into problems with the tool,
you should post your questions to :

http://forums.asp.net/138/ShowForum.aspx

He also said the Dev Team who created the tool would answer questions there.
 
S

Scott Allen

The only one of these that works is $(SolutionDir). Does anybody know
why these aren't available in my .wdproj file and how I can get this
information? Most important is the Configuration being compiled.

The configuration is selected in the <PropertyGroup> sections in your
WDP file. Try the following:

<Target Name="AfterBuild">
<Message Importance="high" Text="SolutionDir: $(SolutionDir)" />
<Message Importance="high" Text="OutputPath: $(OutputPath)" />
<Message Importance="high" Text="Configuration: $(Configuration)" />
</Target>

The common macros that are now working for you are defined in
Microsoft.common.targets, which the WDP doesn't include.
 
D

DBxGlock

Scott,

Thank you! That is exactly what I needed. Those macros work great.
Is there a list of the macros available in WDP?

Thanks,
Dan
 
S

Scott Allen

Scott,

Thank you! That is exactly what I needed. Those macros work great.
Is there a list of the macros available in WDP?

I was trying to figure out all the properties just yesterday (the
MSBuild term is a "property"). I haven't found a way to dump all the
available properties as yet. Some of the properties come from the
..wdproj file, some come from the included targets file. I get the
feeling MSBuild also picks up some from the .sln file, too, but I have
not been able to verify it :/
 
D

DBxGlock

Scott,

I just noticed a few hours ago that it picks up some of those
"properties" from the wdproj file. That was the final piece of the
puzzle because allows me to now copy only the files I want to deploy to
the website to a separate folder.

We have a single website running in IIS and each page has its own
solution (and in VS 2003 its own project). This means that there is a
1-to-1 correlation between aspx and dll files. This made it very hard
to convert to VS 2005. After a lot of prayer and your help, I was able
to put the following 2 lines in the "AfterBuild" target in the wdproj
file:

<Target Name="AfterBuild">
<Copy
SourceFiles="$(MSBuildProjectDirectory)\$(OutputPath)$(SingleAssemblyName).aspx"
DestinationFolder="$(SolutionDir)ForDistribution\Website\$(OutputPath)"
/>
<Copy
SourceFiles="$(MSBuildProjectDirectory)\$(OutputPath)bin\$(SingleAssemblyName).dll"
DestinationFolder="$(SolutionDir)ForDistribution\Website\$(OutputPath)bin"
/>
</Target>

Now when a developer edits the webpage, the App_Web<mangled>.dll and
App_Code.dll files are compiled into a single dll named the same as the
aspx file (assembly name per WDP). Just those 2 files now are copied
to a special directory under the solution so they know exactly what
needs to be deployed (and so they don't accidentally grab a a similarly
named dll instead of the one they mean to deploy).

Dan
 
S

Scott Allen

After a lot of prayer and your help, I was able
to put the following 2 lines in the "AfterBuild" target in the wdproj
file:

Very cool.

P.S. I did find a way to dump all the properties. Run MSBuild from the
command line against the project and specify /v:diag - this sets the
verbosity level to "diagnostic".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top