How to "Enhance" assembly for dynamic types and Op

Posted by Community Admin on 03-Aug-2018 15:15

How to "Enhance" assembly for dynamic types and OpenAccess?

All Replies

Posted by Community Admin on 26-Jan-2011 00:00

I have create a "Sitefinity Intermediate Module" from the Visual Studio templates. I copied the Job and Products samples, but fails to install because I keep hitting this runtime error for my module:

System.Reflection.TargetInvocationException was unhandled by user code
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
       at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
       at System.Activator.CreateInstance[T]()
       at Telerik.Sitefinity.Data.ManagerBase`1.GetManager[T](String providerName, String transactionName)
       at Telerik.Sitefinity.Data.ManagerBase`1.GetManager[T](String providerName)
       at MySampleSpace.Samples.SamplesManager.GetManager(String providerName)
  InnerException: System.Configuration.ConfigurationErrorsException
       Message=Telerik.OpenAccess: No enhanced assembly has been found for meta-data construction. This may be caused by a missing app.config file (use app.config as embedded resource then) or by an insufficient references section in the configuration file (add the referenced enhanced assemblies there too) or by a wrong enhancement setting; please check your configuration.
       Source=Unity_ILEmit_DynamicClasses
       BareMessage=Telerik.OpenAccess: No enhanced assembly has been found for meta-data construction. This may be caused by a missing app.config file (use app.config as embedded resource then) or by an insufficient references section in the configuration file (add the referenced enhanced assemblies there too) or by a wrong enhancement setting; please check your configuration.
       Line=0
       StackTrace:
            at DynamicModule.ns.Wrapped_OpenAccessSamplesDataProvider_5dd14aa3d8aa4957a518d2e18d57cdbb.Initialize(String providerName, NameValueCollection config, Type managerType)
            at Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, Type providerType, ExceptionPolicyName policy, ManagerBase`1 manager)
            at Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(IDataProviderSettings providerSettings, ExceptionPolicyName policy, ManagerBase`1 manager)
            at Telerik.Sitefinity.Data.ManagerBase`1.SetProvider(String providerName, String transactionName)
            at Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName, String transactionName)
            at Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName)
            at Telerik.Sitefinity.Modules.GenericContent.ContentManagerBase`1..ctor(String providerName)
            at MySampleSpace.Samples.SamplesManager..ctor(String providerName)
            at MySampleSpace.Samples.SamplesManager..ctor()
       InnerException:

I got clues from the OpenAccess forums (http://goo.gl/bO6RY), but I do not think I am supposed to install the OA add-in for Visual Studio (otherwise it would have been in the Sitefinity SDK). So what should I do to get over this this error?

Posted by Community Admin on 28-Jan-2011 00:00

Hello Basem,

There are several possible causes of the problem.

First if you have copies the products and jobs module it is possible that the project looks for the VEnhance of OpenAccess in the incorrect library. The problem is that once you move the projects out of the SDK folder the relative path to the enhancer becomes wrong. We have resolved the problem on our side and the fix for that will be included in the internal build that we are about to release later today.

If you want to resolve the problem on your end simply correct the paths to the venhancer by editing the .csproj files in visual studio or notepad. The following script will point to the correct Libraries folder if you declare the following property in a property group before the script is called like that:

Declaring the property:

<LibrariesDir>$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Telerik\SitefinitySDK\@LibrariesDir)</LibrariesDir>

Pointing to the correct location of open access.

<Exec IgnoreExitCode="false" WorkingDirectory="$(TargetDir)" Command=""$(LibrariesDir)VEnhance.exe" -verboseMode:2 "-config:$(ProjectDir)App.config" -signAssembly "-keyFile:$(ProjectDir)$(AssemblyOriginatorKeyFile)" "-assembly:$(TargetPath)"" Condition="'$(AssemblyOriginatorKeyFile)'!=''" />
    <Exec IgnoreExitCode="false" WorkingDirectory="$(TargetDir)" Command=""$(LibrariesDir)VEnhance.exe" -verboseMode:2 "-config:$(ProjectDir)App.config" "-assembly:$(TargetPath)"" Condition="'$(AssemblyOriginatorKeyFile)'==''" />

The second problem could be related to the problem that Visual Studio pick ups all OpenAccess assemblies from the GAC. Thus you have to manually correct all references in your project to point to the correct OpenAccess assemblies - namely those in the Libraries folder of the Sitefinity SDK.

Let me know if you have any other questions.

Bests,
Hristo

Kind regards,
Hristo Borisov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed