This is a migrated thread and some comments may be shown as answers.

Problem using VEnhance with .Net4.0 assembly

2 Answers 179 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Larry
Top achievements
Rank 1
Larry asked on 27 Apr 2010, 07:18 PM
I have a class library with persistent classes using the latest release of OpenAccess.  Previously I had a script to execute VEnhance on this assembly from the command-line to facilitate automated build process.  This worked very well.  

I recently migrated to Visual Studio 2010 and switched the framework target of my persistent classes library to .Net 4.0.  Building this project within Visual Studio and allowing OpenAccess to Enhance and UpdateDatabase works just fine.  However, the command-line call to VEnhance now produces an exception.

If I switch the target framework of my persistent classes library back to v3.5 or below then the command-line call to VEnhance works perfectly.  

What can I do to get the VEnhance tool to work correctly with a v4.0 framework assembly?

Here is what I am executing at the command-line:

"c:\program files\telerik\openaccess orm\sdk\VEnhance.exe" -assembly:C:\Develop\DotNet\KSS.Data\KSS.Data.Model.WM\obj\Debug\KSS.Data.Model.WM.dll -config:C:\Develop\DotNet\KSS.Data\KSS.Data.Model.WM\App.config -debug+ -verbose+

Here are the contents of the exception:

Error executing VEnhance! Output: Telerik OpenAccess Enhancer, Version 2010.1.312.2
Copyright (C) 1996-2010 Telerik
The specified assembly 'C:\Documents and Settings\xxxxxx\Local Settings\Temp\_ptil_3772\KSS.Data.Model.WM.dll' cannot be loaded. The problem might be that the platform target is set to x64 or itanium. Only x86 is supported now.
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun()
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.DomainRun(Boolean createDomain)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.Start(EnhancerSettings _settings)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.ConsoleRun(EnhancerSettings settings)
InnerException:
Could not load file or assembly 'file:///C:\Documents and Settings\xxxxxx\Local Settings\Temp\_ptil_3772\KSS.Data.Model.WM.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
 Error: 
Unhandled Exception: Telerik.OpenAccess.Sdk.Enhancer.EnhancerException: The specified assembly 'C:\Documents and Settings\xxxxxx\Local Settings\Temp\_ptil_3772\KSS.Data.Model.WM.dll' cannot be loaded. The problem might be that the platform target is set to x64 or itanium. Only x86 is supported now. ---> System.BadImageFormatException: Could not load file or assembly 'file:///C:\Documents and Settings\xxxxxx\Local Settings\Temp\_ptil_3772\KSS.Data.Model.WM.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'file:///C:\Documents and Settings\xxxxxx\Local Settings\Temp\_ptil_3772\KSS.Data.Model.WM.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

   --- End of inner exception stack trace ---
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun()
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.DomainRun(Boolean createDomain)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.Start(EnhancerSettings _settings)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.ConsoleRun(EnhancerSettings settings)
   at Telerik.OpenAccess.Tools.Enhancer.Main(String[] args)
 

2 Answers, 1 is accepted

Sort by
0
Accepted
Jan Blessenohl
Telerik team
answered on 29 Apr 2010, 09:22 AM
Hi Larry,
You have to tell the enhancer to run in a 4.0 vm. To do so please place a venhance.exe.config file in the same directory with this content:

<?xml version="1.0"?>
<configuration>
<startup>
  <!--<supportedRuntime version="v2.0.50727"/>-->
  <supportedRuntime version="v4.0"/>
</startup>
</configuration>

The enhancer now starts as 4.0 process and the outcome will be a 4.0 assembly.

All the best,
Jan Blessenohl
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.
0
Larry
Top achievements
Rank 1
answered on 29 Apr 2010, 01:37 PM
Thanks Jan! That did the trick.  I subsequently had the same issue with VSchema, but the same solution using a vschema.exe.config solved that as well.
Tags
Design Time (Visual Designer & Tools)
Asked by
Larry
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Larry
Top achievements
Rank 1
Share this question
or