: This article contains information about modifying the registry.
Before you modify the registry, make sure to back it up and make sure that you
understand how to restore the registry if a problem occurs. For information
about how to back up, restore, and edit the registry, click the following
article number to view the article in the Microsoft Knowledge Base:
Description of the Microsoft Windows Registry
This step-by-step article describes how to implement build
events in Visual C# .NET or Visual C# 2005.
When you use build events, you can specify
an action that occurs at a specific time during the build process. For example,
you can specify a post-build event to register a file by using regsvr32.exe.
You can also view and make a change to a generated assembly in the GAC (Global
Assembly Cache) by using the Gacutil.exe tool.
In Visual C# .NET or Visual C# 2005,
there are no direct methods to specify pre-build and post-build
Use a Visual C++ Makefile Project to Implement Build Events
Build events are a built-in feature of
Microsoft Visual C++ .NET projects. You can implement these events in a Visual
C# .NET or Visual C# 2005 project by including a Visual C++ .NET Makefile project in the
solution. To implement pre-build
events, you must make the Visual C++ .NET Makefile project
dependant on the Visual C# .NET or Visual C# 2005 project. To implement post-build
events, you must make the Visual C# .NET or Visual C# 2005 project dependant on the
Visual C++ .NET Makefile project.
To do this, follow these steps:
- Open your existing Visual C# .NET or Visual C# 2005 solution.
- On the File menu, point to Add
Project, and then click New Project.
- Under Project Types, click Visual
C++ Projects, and under Templates, click
Note In Visual Studio 2005, "Visual
C++ Projects" should be changed to "Visual
- Type the name for the solution, specify a location for the
solution, and then click OK.
- In the Makefile Application Wizard, click Finish.
- On the Project menu of the Makefile Project, click Properties.
- In the Configuration Type box, select Utility, and then click OK.
- On the Project menu, click Project Dependencies…. To perform the pre-build events, follow these steps:
- On the Dependencies tab, select the
appropriate Visual C# .NET project from the
Projects list, and then under Depends on,
click the Visual C++ Makefile project .
- Click OK to apply the change. This
makes sure that the Visual C# .NET or Visual C# 2005 project is built last.
- Right-click the Visual C++ Makefile project in Solution Explorer, and then click Properties.
- Click Build Events, and then specify the pre-build event command.
to copy the file before building, specify the following:
copy c:\AddinReg.reg $(OutDir)
- To perform the post-build setup, follow these steps:
- Click the Visual C++ Makefile project
in the Projects list, and then select the appropriate Visual
C# .NET or Visual C# 2005 project under Depends on.
- Click OK to apply the change. This makes sure that the Visual C++ project
is built last.
- Right-click the Visual C++ Makefile project in Solution
Explorer, click Properties, and then click Build
Events to specify the post-build event command.
Use the PrePostBuildRules Add-In to Implement Build Events
- This add-in provides pre-build and post-build rules at the
solution and project levels.
To download the add-in, see the the following
Microsoft Web site:
WARNING: If you use Registry Editor incorrectly, you may cause serious
problems that may require you to reinstall your operating system. Microsoft
cannot guarantee that you can solve problems that result from using Registry
Editor incorrectly. Use Registry Editor at your own risk.
To use this add-in, follow these steps :
- Load the solution file with this source, and then
build the solution.
- On Tools menu, click Add-In Manager. If the Add-In Manager is already open, close it, and then open
Note If the new add-in appears in the Add-In
Manager list of add-ins, you have successfully registered the add-in.
- If the add-in does not appear in the Add-In
Manager list, follow the steps to register it manually:
- Locate the AddinReg.reg file in the BuildRules folder.
- Right-click AddinReg.reg, and then
click Merge. Click Yes when prompted to add the entries to the registry.
- The new entries made to the registry can be seen in
the following location:
- Start a new instance of Visual Studio .NET or Visual Studio 2005.
- On the Tools menu, click the new add-in.
- A dialog box appears that allows you to select the
solution or project, and to add rules to it.
- When you add a rule, you can specify the name echo as the program name to display raw text in the output
For additional information, see the following Microsoft Web
Automation Samples for Visual Studio .NEThttp://www.microsoft.com/downloads/details.aspx?familyid=3ff9c915-30e5-430e-95b3-621dccd25150&displaylang=en
Article ID: 810230 - Last Review: January 10, 2007 - Revision: 3.3
- Microsoft Visual C# .NET 2002 Standard Edition
- Microsoft Visual C# .NET 2003 Standard Edition
- Microsoft Visual C++ .NET 2002 Standard Edition
- Microsoft Visual C++ .NET 2003 Standard Edition
- Microsoft Visual C# 2005 Express Edition
|kbdownload kbhowtomaster kbcompiler kbhowto KB810230|