Registering a CCW (COM Callable Wrapper) in a build

A  CCW (COM Callable Wrapper)  acts just like a COM object,  therefore it needs to be registered with the operating system.  There are a few steps to doing this:

First you'll need to make sure the COM Callable Wrapper is strong named.  This can be done in the signing section of the properties window of your project.  Right click on the project in the Solution Explorer and choose properties.  Go to the Signing tab and check Sign the Assembly. Also generate a strong name file.

You can generate a strong name file using the strong name command-line tool

sn -k keyPair.snk

Now you need to register your CCW after the build.  Go to the Build Events tab and put the following lines in the Post Build section:

gacutil.exe /nologo /i "$(TargetPath)" /f;
regasm  /codebase "$(TargetPath)"

You'll need to make sure these tools are in your path

regasm is located in: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

gacutil is located in:
c:\program files\microsoft visual studio 8\sdk\v2.0\Bin

 

 

Ebook Download
View all
Learn
View all