its not really a complete solution. I decided to bail on using it. Unfortunately
this moves a lot of code to the prebuild, postbuild, and external batch files.
First things first... You have to understand that a Reg Free COM manifest must
contain ALL the information that would normally go in the registry. This comes
from ALL the "rgs" files in your project and the project's type library. [I'm
not sure what you will do if you have more than one typelib being produced by
your project. I would probably collapse them all into a single idl/tlb.]
The manifest tool only allows you to provide a single "rgs" and "tlb" on his
command line. Its easy enough to merge the rgs files in a prebuild step [cmd /c
type *.rgs > RTM.rgs] That is where the easy ends...
A little fore-note, the reason this gets messy is because of the power we are
going to leverage. We are doing what I call a Release to Marketing (RTM) build.
In this build style we will be placing versioned dlls into \windows\winsxs. You
can only place dlls there via a .msi installer. Adding that step would make
debugging a mess. The release build can run as usual with the dlls simply
registered. The RTM process does the necessary conversion steps and is only done
when a release is being cut.
For this trick to work, we will write a batch file that causes all the steps
necessary for a sxs install. Believe me there are many...
Here is the post-build step:
"$(SolutionDir)RTMBroker\bin\mt" /nologo -manifest "$(TargetPath).manifest" -outputresource:"$(TargetPath)";2
echo call "$(SolutionDir)RTMBroker\MakeDLLIntoAssembly" "$(SolutionDir)RTMBroker" "$(TargetDir)" $(TargetName) "$(TargetFileName)" VTX.tlb 188.8.131.52 fbf3841e0e84639c AJTSystems >> "$(SolutionDir)RTMBroker\FusionizeBuild.bat"
echo del /F "$(TargetPath)" >> "$(SolutionDir)RTMBroker\DeleteBuildProducts.bat"
The first line embeds the manifest so we can run normally.
The second gives all the info needed to my batch file. The the third makes it
so I can delete all my final build products without rebuilding. (This
is needed for back to back builds since you can't sign an assembly twice.)
This entry is for generating manifests, so I'm only going to dive into that
part of the batch file today. The code to do this is as follows:
%1\bin\mt /nologo -rgs:..\RTM.rgs -tlb:%5 -dll:%4 -identity:"%3, processorArchitecture=x86, version=%6, type=win32, publicKeyToken=%7" -out:%4.sxs.manifest
Remember, we are handing around parameters to a batch file, so you need to
understand the % notations: they are the parameters we wrote to
FusionizeBuild.bat in order from [1 to n].
%1: where our RTM files are located
%3: our assembly name
%4: our dll name
%5: our tlb
%6: our version
Also remember this is for a sxs install. For a real "localized" install [where
the dll runs from the same directory as the exe] you can do without the
publicKeyToken and the name needs to be the same as the assembly of the
executable. If you are using control's that are based on IDispatch then you wil
l probably need to do them as localized. I've not gotten IDispatch to work when
the assembly is in \windows\winsxs.
There we go... you now have a manifest. At this point you are probably thinking:
"Matty, what is the point of that? I can put all that information into the
visual studio ide. Isn't that easier?"
Well, technically, yes you could, especially if you are doing a localized build
with no .net interop. We are targeting sxs and also have to make interop dlls
work. That adds a big chunk of other requirements, so you will have to hand all
the same information to the batch file anyway. I prefer to have the whole
process in one pile vs having to edit one file then hunt and peck in the ide.
This is all using c++. If you have a vb ocx you are in for a new set of problems
to make the manifest. The MSDN documentation pretty much says that you should
hand write you manifest. (Ha, some of these things are 1000 lines+) There is a
GPL tool called regsvr42 that will probe a com dll or ocx and make a capable
manifest. Its got a few bugs in it though [no support to hand in all the parts
of the assembly identity, "version" is strncmp'ed against an index to small, and
it can write out duplicate iid entries that break the rules of the manifest
such that windows complains about the syntax and exits]
You can download it over on "code project". I'm going to post the fixed version
of it on my gamedev space when I get time. If you need it sooner just private