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

OpenAccess enabling an assembly in VS2010 forces it to use .net 4.0

16 Answers 465 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dan
Top achievements
Rank 1
Dan asked on 20 Nov 2009, 09:38 PM
I have created a test solution to test an error I was having while converting a VS2008 solution to VS2010 beta 2.  The solution consists of 2 projects, the first being an OpenAccess enabled dll for persistent classes, the second a console application that uses the ORM dll to connect to a database.  In my simple test replication, I create a solution with a console app and a class library.  I set the target framework for both projects to be .net 3.5.  This compiles fine, however once I right click on the class library and enable it for OpenAccess, the solution no longer builds.  I get the following warning:

C:\Windows\Microsoft.NET\Framework\v4.0.21006\Microsoft.Common.targets(1291,9): warning MSB3258: The primary reference "D:\Work\Projects\35Test\35Test\bin\Debug\35Test.dll" could not be resolved because it has an indirect dependency on the .NET Framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.

Any help would be greatly appreciated, Thanks

-Lars Solberg

16 Answers, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 23 Nov 2009, 10:43 AM
Hello Lars Solberg,
It depends which assemblies you are referencing. Our Telerik.OpenAccess.dll is pure .NET 2.0. Do you have references to other OpenAccess assemblies?
Maybe the conversion wizard just set the Framework property of your project to 4.0.

Greetings,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Dan
Top achievements
Rank 1
answered on 23 Nov 2009, 02:52 PM
Jan,

I have ignored the conversion process and the test has started from scratch with both projects targeting .NET 3.5.  It builds to 3.5 until I enable the project for OpenAccess which adds OpenAccess.dll and OpenAccess.Query.dll.  I've checked all of the project files to ensure that 3.5 is the target, and the launching application still claims that the ORM project is in 4.0.

Thanks again.
0
Accepted
Jan Blessenohl
Telerik team
answered on 24 Nov 2009, 09:27 AM
Hello Lars Solberg,
You are right, after double checking it looks like our enhancer is always generating .NET 4.0 assemblies if it is started in the default way. We will fix that.

The workaround is to use the post build event to start the enhancer:
"c:\programs files\telerik\openaccess orm\sdk\venhance.exe" "-assembly:$(TargetPath)"
Please replace the path and set the event to 'when the build updates the project output'.

You can also use the OpenAccess targets file. Please have a look here.

http://www.telerik.com/help/openaccess-orm/openaccess-msbuild-integration.html

Kind regards,
Jan Blessenohl
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
shawn reagan
Top achievements
Rank 1
answered on 22 Feb 2010, 03:11 AM
Any patch for this yet?  I'm having the same issue and I don't really understand the workaround posted above.  Any help greatly appreciated.

Thank you.
0
shawn reagan
Top achievements
Rank 1
answered on 24 Feb 2010, 02:39 AM
I think I may have gotten it.  One thing I had to do that I don't fully understand why is to go into "Advanced Compiler Settings" and change the Target CPU ot 'x86' instead of 'Any CPU'.

Is this a necessary step???
0
Jan Blessenohl
Telerik team
answered on 24 Feb 2010, 07:19 AM
Hello shawn reagan,
On a 32 bit machine it is working but on a 64 bit machine it is not. To be sure that it always works please change to 'Any CPU'

Regards,
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
Michael Josiah
Top achievements
Rank 1
answered on 26 Feb 2010, 09:14 AM
I'm also waiting for a patch for this issue as I too dont understand the workaround and really I should not have to.
0
Kevin Williams
Top achievements
Rank 2
answered on 01 Mar 2010, 02:23 PM
Do you know when this issue will be resolved? We're evaluating the ORM tool set now and cannot get past this problem.

Thanks,
Kevin
0
Greg Lynne
Top achievements
Rank 1
answered on 02 Mar 2010, 06:59 PM
I too am evaluating the OpenAccess in VS2010 (With no luck yet) and have managed to update the Post Build event command line with this :"C:\Program Files\Telerik\OpenAccess ORM\sdk\venhance.exe" "-assembly:$(TargetPath)" and have changed the combobox to "When the build updates the project output". But It is not working? You stated "Please replace the path", I presume you meant the path to venhance.exe? How do I get it to use the correct version of .net?
0
Jan Blessenohl
Telerik team
answered on 02 Mar 2010, 10:52 PM
Hi Andrew Brown,
Additionally you have to change the project settings so that the enhancer is not called twice. Select the project, press F4 and disable enhancing.

If you see errors, can you please send me the content of the build output window so that I can analyze it?

Sincerely yours,
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
Kevin Williams
Top achievements
Rank 2
answered on 03 Mar 2010, 06:42 PM
Looks like this alone fixed the problem. I removed all of the post-build event code and just set this one setting. Thanks!
0
Greg Lynne
Top achievements
Rank 1
answered on 03 Mar 2010, 06:53 PM
Thank you for your response. It is working now.
0
Lev Rosenblit
Top achievements
Rank 2
answered on 28 Apr 2010, 03:22 PM
Hello,
I'm using VS2010, in windows 7 x64.
i migrated a web application (.NET 3.5) from VS2008 to VS2010, then i encountered the problem of .net4.0 reference to the OA enabled (persistent classes) library project that made the solution to error with "no assembly".
I came across this (and other) posts on this problem, and I've set "Enhancing=False" in the project properties  and added a post-build event to call venhance.
I am calling the correct path, and venhance runs (does its job, because the solution compiles and when i publish it, it works fine) but failes in the compilation phase, and displayes:
Error   226 The command ""C:\Program Files (x86)\Telerik\OpenAccess ORM\sdk\venhance.exe" "-assembly:D:\...\EntityModel\bin\Debug\EntityModel.dll"" exited with code -1073740940.  EntityModel 
 
then, the solution continues building, and everything is fine except this annoying message.
btw, when i run venhance manually from CMD (not as a post-build event) it doesnt fail, and works fine.

Its annoying to wait 10 seconds for venhance to display a crashing dialog before the solution continues building every time i rebuild.
Am I forgetting something? or is there a way to have VS2010 disregard this error?

Thanks,
Lev Rosenblit
0
Jan Blessenohl
Telerik team
answered on 29 Apr 2010, 12:27 PM
Hello Lev Rosenblit,
The problem is that the compiler always copies the dll from the obj to the bin dir. This starts the enhancer again.
You should enhance the dll in the obj\debug dir and copy it to the bin\debug in a second line in your post build event.

Kind regards,
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
Andrew Kitchens
Top achievements
Rank 1
answered on 09 Jul 2010, 11:28 PM
When is this issue scheduled to be fixed. I just downloaded and installed the newest version of OpenAccess (2010.1.623.5), and the problem still exists. Its been 8 months since the problem was reported. BTW, the zip file Telerik_OpenAccess_ORM_2010_1_624_dev.zip actually contains version 2010.1.623.5.
0
Jan Blessenohl
Telerik team
answered on 12 Jul 2010, 09:22 AM
Hi Andrew Kitchens,
The problem is fixed, the visual studio integration should work out of the box, the venhance.exe got an config file that is patched by the installer to run under .Net 4.0. My guess is that the config file is not patched by the installer. Can you please make sure that the executables in the bin and sdk folders have a config file with the following content:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <startup>
    <!--The enhancer is compiled against .NET 2.0. -->
    <!-- To be able to enhance an .NET 4.0 assembly please uncomment the next line:-->
    <supportedRuntime version="v4.0"/>
  </startup>
</configuration>


Greetings,
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
Tags
General Discussions
Asked by
Dan
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Dan
Top achievements
Rank 1
shawn reagan
Top achievements
Rank 1
Michael Josiah
Top achievements
Rank 1
Kevin Williams
Top achievements
Rank 2
Greg Lynne
Top achievements
Rank 1
Lev Rosenblit
Top achievements
Rank 2
Andrew Kitchens
Top achievements
Rank 1
Share this question
or