VS 2005 "Web Deployment Projects" wdproj lacks macros?

Discussion in 'ASP .Net' started by DBxGlock, Nov 17, 2005.

  1. DBxGlock

    DBxGlock Guest

    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
     
    DBxGlock, Nov 17, 2005
    #1
    1. Advertising

  2. 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.




    Juan T. Llibre, ASP.NET MVP
    ASP.NET FAQ : http://asp.net.do/faq/
    ASPNETFAQ.COM : http://www.aspnetfaq.com/
    Foros de ASP.NET en EspaƱol : http://asp.net.do/foros/
    ======================================
    "DBxGlock" <> wrote in message
    news:...
    > 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
    >
     
    Juan T. Llibre, Nov 17, 2005
    #2
    1. Advertising

  3. DBxGlock

    Scott Allen Guest

    On 17 Nov 2005 05:46:19 -0800, "DBxGlock" <> wrote:

    >
    >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.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/
     
    Scott Allen, Nov 17, 2005
    #3
  4. DBxGlock

    DBxGlock Guest

    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
     
    DBxGlock, Nov 17, 2005
    #4
  5. DBxGlock

    Scott Allen Guest

    On 17 Nov 2005 09:02:39 -0800, "DBxGlock" <> wrote:

    >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 :/

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/
     
    Scott Allen, Nov 17, 2005
    #5
  6. DBxGlock

    DBxGlock Guest

    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
     
    DBxGlock, Nov 17, 2005
    #6
  7. DBxGlock

    Scott Allen Guest

    On 17 Nov 2005 13:05:54 -0800, "DBxGlock" <> wrote:

    >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".

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/
     
    Scott Allen, Nov 18, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?QnJhZGxleUI=?=

    Visual Studio 2005 Web Deployment Projects

    =?Utf-8?B?QnJhZGxleUI=?=, Nov 10, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    360
    =?Utf-8?B?QnJhZGxleUI=?=
    Nov 10, 2005
  2. Replies:
    80
    Views:
    2,453
    Stephen J. Bevan
    Nov 7, 2003
  3. Replies:
    1
    Views:
    464
    Marco Antoniotti
    Oct 7, 2003
  4. Replies:
    5
    Views:
    506
  5. Michael T. Babcock

    Re: Explanation of macros; Haskell macros

    Michael T. Babcock, Nov 3, 2003, in forum: Python
    Replies:
    0
    Views:
    530
    Michael T. Babcock
    Nov 3, 2003
Loading...

Share This Page