We're building a C# wrapper for a C library in embedded Linux, and we want to install it into the GAC of the target system.
To do that, I've used sn
to create a keypair and mcs
to compile the code:
sn -k keypair.snk
mcs /target:library -keyfile:keypair.snk -out:MyLib.dll src/*.cs
Now, once that's built, I use gacutil
to inject it into the GAC with:
gacutil /i -gacdir /path/to/gac MyLib.dll
What I end up with is the correct file structure but the version number is set to 0.0.0.0
:
.../usr/lib/mono/gac/MyLib
.../usr/lib/mono/gac/MyLib/0.0.0.0__3141592653589fff
.../usr/lib/mono/gac/MyLib/0.0.0.0__3141592653589fff/MyLib.dll
I want the version of the wrapper to match that of the underlying C code being used so my question is (hopefully) a simple one. Where is that current version coming from, and how do I get it to be 3.14.15.9
(for example)?
Add an assembly level attribute called
AssemblyVersion
to your C# source. This is usually added in a file namedAssemblyInfo.cs
:Note: This is a cut/paste of an auto-generated project file, I updated the AssemblyVersion attribute and you only have to include the attributes you want the CIL assembly to contain
Add that source file to the others that you are compiling.
Install it:
And retrieve the details:
File system: