Solved

Creating Visual Studio 2005 Macros

Posted on 2006-10-23
5
1,079 Views
Last Modified: 2010-08-05
I'd think that this should be simple but I can't seem to find any documentation on how to do this. There are some samples for relatively sophisticated macros. I know that I can record macros as well. However, I need to create some path macros for VS 2005 that I can use in my build process but I don't see how to record just a path this way.

When you look at project properties and edit (for instance) the Command Line in the Post-Build Events you can click on the "Macros>>" button and get a selection of macros that are used in the command line, like $(InputPath). Most of these look like pretty simple replacements for inserting pathnames or module names, etc.

I use this to copy my build files to the actual deployment directory after building, for example:

C:\Program Files\Client\ClientApp\Components (for release builds)

C:\Program Files\Client\Debug\ClientApp\Components (for debug builds)

However, right now I have to hard-code these paths into the command line. I would like to create my own macros, specifically for these deployment directory path names, to use in my post-build command line. I need macros for the  something like "DeployDir" or "DebugDeployDir" that could be used instead of the hard-coded paths -- like $(DeployDir). It would be perfect if the macro itself could differentiate between debug and release builds itself and modify the path variable.

And I would need to distribute these macros to all of our developers working on the project. Are these macros (like InputName, InputPath, IntDir, etc.) recorded in a file somewhere that I could look at?

This is pretty urgent, as well.

Thanks.
0
Comment
Question by:jimwasson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 17794011
I would try to solve this problem using environment variables and batch files. Consider the following post-build command:

CopyFiles.bat $(ConfigurationName)

Inside of CopyFiles.bat you can test first parameter (Debug or Release) and copy files to one of two output directories using environment variables, for example, %DebugDeploymentDir% and %ReleaseDeploymentDir%. To distribute evvironment variables to all developer computers you can make .reg file which adds these variables to the Registry.
0
 
LVL 7

Author Comment

by:jimwasson
ID: 17795744
That's a good suggestion Alex. I may have to do that if I can't figure out how to build and use the VS macros. I really do need to use a macro that I can make somewhat cleverer, though. My project includes about 10 executables and maybe 30 dlls which get deployed into about 8 to 10 subdirectories. I may end up having to drastically simplify the deployment structure, though.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question