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

17 posts, 1 answers
  1. Dan
    Dan avatar
    35 posts
    Member since:
    Oct 2008

    Posted 20 Nov 2009 Link to this post

    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
  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 23 Nov 2009 Link to this post

    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.
  3. DevCraft banner
  4. Dan
    Dan avatar
    35 posts
    Member since:
    Oct 2008

    Posted 23 Nov 2009 Link to this post

    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.
  5. Answer
    Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 24 Nov 2009 Link to this post

    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.
  6. shawn reagan
    shawn reagan avatar
    14 posts
    Member since:
    Feb 2010

    Posted 21 Feb 2010 Link to this post

    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.
  7. shawn reagan
    shawn reagan avatar
    14 posts
    Member since:
    Feb 2010

    Posted 23 Feb 2010 Link to this post

    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???
  8. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 24 Feb 2010 Link to this post

    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.
  9. Michael Josiah
    Michael Josiah avatar
    92 posts
    Member since:
    Nov 2007

    Posted 26 Feb 2010 Link to this post

    I'm also waiting for a patch for this issue as I too dont understand the workaround and really I should not have to.
  10. Kevin Williams
    Kevin Williams avatar
    6 posts
    Member since:
    Dec 2004

    Posted 01 Mar 2010 Link to this post

    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
  11. Greg Lynne
    Greg Lynne avatar
    31 posts
    Member since:
    Mar 2010

    Posted 02 Mar 2010 Link to this post

    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?
  12. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 02 Mar 2010 Link to this post

    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.
  13. Kevin Williams
    Kevin Williams avatar
    6 posts
    Member since:
    Dec 2004

    Posted 03 Mar 2010 Link to this post

    Looks like this alone fixed the problem. I removed all of the post-build event code and just set this one setting. Thanks!
  14. Greg Lynne
    Greg Lynne avatar
    31 posts
    Member since:
    Mar 2010

    Posted 03 Mar 2010 Link to this post

    Thank you for your response. It is working now.
  15. Lev Rosenblit
    Lev Rosenblit avatar
    16 posts
    Member since:
    May 2008

    Posted 28 Apr 2010 Link to this post

    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
  16. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 29 Apr 2010 Link to this post

    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.
  17. Andrew Kitchens
    Andrew Kitchens avatar
    3 posts
    Member since:
    Oct 2009

    Posted 09 Jul 2010 Link to this post

    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.
  18. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 12 Jul 2010 Link to this post

    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
Back to Top
DevCraft banner