Reputation:
I am using gacutil.exe
to register an assembly into the Global Assembly Cache (GAC). My DLL is located at the root of my C:
drive:
C:\XYZ.dll
I've tried
gacutil.exe /i "C:\XYZ.dll"
but this gives me the following error:
An attempt was made to load a program with incorrect format
Why is this?
Upvotes: 1
Views: 4102
Reputation: 1627
your assembly should be strongly named to be placed in the GAC. Have you assigned a strong name to your assembly. You can assign using the following syntax
SN –k MyDll.snk
csc /keyfile:MyDll.snk XYZ.cs
Or you can optionally sign the assembly using the visual studio , you can create a new public/private key file by displaying the properties for your project, clicking the Signing tab, selecting the Sign The Assembly checkbox, and then choosing the option from the Choose A Strong Name Key File combobox. This method would sign the assembly.
You will find loads of articles to where you can find why strong name is required for the assembly
Upvotes: 1