<OpenAccessEnhancer
Assembly="<path>\obj\Release\MyModel.dll"
KeyFile="<path>\MyKey.snk" >
<
Output TaskParameter="Version" PropertyName="OpenAccessEnhancerVersion" />
</
OpenAccessEnhancer>
When I run this I can see in the log that it enhances the class, but then it stops with the error "OpenAccess Enhancer error 0: Generated method is null. Usually this indicates, that assembly signing is used with an external key store. Please use an AssemblyKeyFileAttribute instead."
Because I keep getting te error message I tried the same thing using the commandline utility "venhance.exe". But this gives the same error message.
Using the "AssemblyKeyFileAttribute" I'm able to enhance the project. But I don't want to use a AssemblyKeyFileAttribute because that's relative to my file system and not the system on which the automated build will run.
My Visual Studio is able to build and enhance the assembly without this attribute. Therefore I've cut and past the command, used by Visual Studio (build output window), in a command prompt expecting a successfull enhancement. But even this give the same error as before.
Why is Visual Studio able to Enhance the project and is it not possible from the command line (or MSBuild script)? What am I doing wrong?
I'm using Visual Studio 2008 and 'Telerik OpenAccess Enhancer, Version 2009.1.311.1'
With regards,
Vincent
8 Answers, 1 is accepted
please have a look at the OpenAccess.targets file from the Telerik\OpenAccess ORM\sdk folder.
There you will see the full invocation of the enhancer:
<OpenAccessEnhancer |
VerboseMode="$(EnhancementOutputLevel)" |
Assembly="@(IntermediateAssembly->'%(FullPath)')" |
SignAssembly="$(SignAssembly)" |
KeyFile="$(AssemblyOriginatorKeyFile)" |
KeyContainer="$(KeyContainerName)" |
References="@(ReferencePath)" |
ProjectReferences="@(ProjectReference)"> |
<Output TaskParameter="Version" PropertyName="OpenAccessEnhancerVersion" /> |
</OpenAccessEnhancer> |
I guess that the SignAssembly setting needs to be given in addition.
Greetings,
Thomas
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

Visula Studio only specifies the assembly and keyfile properties when calling the venhance.exe. But when I execute the same command in a command prompt I get the same error as when using MSBuild.

Also for the KeyFileNameAttribute the key file needs to be a .SNK file generated by sn.exe NOT the snk.pfx generated within Visual Studio.
I am afraid you will have to use the AssemblyKeyFileAttribute anyways. Sorry for the inconvenience but we are unable to provide you with a workaround for this. In fact, what you see in the output is not the exact command that is executed by Visual Studio, it has a different way to call the enhancer.
Best wishes,
Alexander
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

James
Yes, the path is relative to the project's path. So if the key file is in the project directory, you can just specify its name:
[assembly: AssemblyKeyFileAttribute("key.snk")] |
Greetings,
Alexander
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.

Error 10 OpenAccess Error: Enhancer: Could not open the key file 'MyKeyFile.snk'.
You should use an absolute file name.
Reason: Could not find file 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Pinpoint.snk'. MyAssembly.dll
I want to keep one keyfile for all assemblies in one place and that place should be relative to the project folders, regardless of where they are on the file system. Any chance this could be looked at?
Are you sure you have specified the correct relative path in the attribute? I have just tested moving the .snk file around and it worked fine. And I got the same exception when intentionally set a wrong file name.
Greetings,
Alexander
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.