I would like to implement a post build event that performs the following actions
- A relative path copy of the DLL output (1 file, not all the debug jazz)
- A register the output DLL to GAC
How is this done?
I would like to implement a post build event that performs the following actions
How is this done?
Does that do you want?
copy $(TargetPath) $(TargetDir)..\..\someFolder\myoutput.dll
regasm $(TargetPath)
(Entered into the field for post-build step under project properties)
you may want to look at MS Build. Its what we use here at work.
Enter following into "Project properties->Build events->Post build events command line:"
xcopy "$(TargetPath)" "target path" /Y && regasm "$(TargetPath)"
or add following snippet to project (e.g. csproj) file
<PropertyGroup>
<PostBuildEvent>xcopy "$(TargetPath)" "target path" /Y && regasm "$(TargetPath)"</PostBuildEvent>
</PropertyGroup>
Note that it is recommended to add "" around copy command arguments to avoid problems with paths containing whitespaces. Also note that multiple commands can be combined using &&
Are you sure you want to do this as part of a compile? I would recommend using project references in solutions rather than the GAC if you can avoid it. Copying files is one thing, but registering in the GAC is fairly intrusive and you may want to consider the other environments your code is compiled in. Things like other developers' machines, and test environments/build servers etc. If you have a build server really you should be using something like NAnt with some sort of continuous integration server.