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

Old references seems to be a ghost in my project

4 Answers 1133 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.
Joel
Top achievements
Rank 1
Joel asked on 10 Apr 2015, 07:29 AM

Hello, System developing student from Sweden here!

I have a problem with Telerik.OpenAccess.Extensions.35 somehow being referenced in my project so I cannot build it. To make a long story short I think I have managed to analyze it to:
1. A co-worker had troubles running, upgraded his version his library of Telerik.DataAccess.Core from 2014 to 2015.
2. He accidently commit's his upgraded web.config and .csproj files to TFS.
3. I 'Get latest changes' and receieve these files, I cannot build project, the DLL needs upgraded versions of dependencies.
4. We manually try to override conflicting files and analyze each individually to map the path and versions. Doesn't help.
5. We try to 'Upgrade references' to no prevail.
6. I try to put each of the Telerik dependencies in a libraries map with correct versions to every file and point to these from the csproj file, doesn't help.
7. I then try to upgrade my Telerik.DataAccess.Core from both nuget and via tooltip from you saying there is a new version available. Doesn't help.
8. 'Upgrade references' again, only shifts mapping from libraries to C:\Program Files (x86)\ folder.
9. I try on a different computer with a clean installation of both Visual Studio and Telerik and gets the latest version of project, doesn't help. It doesn't fail to build but when I try to run it, the first occurence of code trying to use any DataAccess i get a System.TypeInitializationException and cannot work around this even if I follow steps from a thread on your forum.
10. I take the builded dll file from the second computer unto the first computer, since it should have been built with correct versions of Telerik dependencies and I should have all those properly referenced on the first computer, right? Nope.
11. I get prompted from my first computer that it cannot load assembly Telerik.OpenAccess.Extensions.35, Version=2014.3.1209.1 since the one I got in the libraries are of a newer version. Nowhere in csproj, web.config or anywhere else is this version referenced. Everything everywhere points to the newer 2015.1.225.1 versions. I try to obliege(spelling?) and exchange this version of the file to a the one it asks for, then upon build I get prompted "Signature of the body and declaration in a method implementation do not match.  Type: 'XXXX.OADomainModel'". <-- XXXX being my class name

Now I'm a very patience man but this makes me crazy. I've tried everything for the last couple of days. Nothing makes it work. Somehow there is a ghost referencing to old versions and when I give it what it asks it, it changes the conditions. My co-worker can build just fine without any incidents and I made a IDENTICAL copy of his project on a new computer, with a fresh installment of both Telerik and Visual Studio.

So what is the error here? Including both types of error messages, XXXXX is project dll (class name):

When I have newer versions and try to build:
Warning 1 Unable to load assembly 'XXXX, Version=1.0.5577.25190, Culture=neutral, PublicKeyToken=null' : Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2014.3.1209.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
ExceptionString:
System.SystemException: Unable to load assembly 'XXXX, Version=1.0.5577.25190, Culture=neutral, PublicKeyToken=null' : Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2014.3.1209.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500) ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
   --- End of inner exception stack trace ---
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.ReadMetaModel(Assembly assembly)
   at Telerik.OpenAccess.Metadata.AttributesMetadataSource.<>c__DisplayClass1.<FromAssembly>b__0()
   at Telerik.OpenAccess.Metadata.AttributesMetadataSource.CreateModel()
   at Telerik.OpenAccess.Metadata.MetadataSource.GetModelCore(MetadataContainer old)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun() XXXX.dll XXXX.Web

When I put a newer version on requested path:
Error 2 Unable to load assembly 'XXXX, Version=1.0.5578.15058, Culture=neutral, PublicKeyToken=null' : Signature of the body and declaration in a method implementation do not match.  Type: 'XXXX.OADomainModel'.  Assembly: 'XXXX, Version=1.0.5578.15058, Culture=neutral, PublicKeyToken=null'.
ExceptionString:
System.SystemException: Unable to load assembly 'XXXX, Version=1.0.5578.15058, Culture=neutral, PublicKeyToken=null' : Signature of the body and declaration in a method implementation do not match.  Type: 'XXXX.OADomainModel'.  Assembly: 'XXXX, Version=1.0.5578.15058, Culture=neutral, PublicKeyToken=null'. ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
   --- End of inner exception stack trace ---
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
   at Telerik.OpenAccess.Metadata.MetadataAttributesReader.ReadMetaModel(Assembly assembly)
   at Telerik.OpenAccess.Metadata.AttributesMetadataSource.<>c__DisplayClass1.<FromAssembly>b__0()
   at Telerik.OpenAccess.Metadata.AttributesMetadataSource.CreateModel()
   at Telerik.OpenAccess.Metadata.MetadataSource.GetModelCore(MetadataContainer old)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun() XXXX.dll XXXX.Web

4 Answers, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 13 Apr 2015, 09:20 AM
Hello Joel,

I understand exactly how maddening the situation can be and the good thing is that it can be easily resolved.

The first thing you need to do is decide whether you are going to use the NuGet packages in your solution, or you are going to use an installed version of Telerik Data Access. Using both is not an option because in addition to the build time errors, it is very likely that you will experience runtime errors as well (especially, when there is a mismatch between the versions of the Data Access assemblies).
The second thing is to decide which version to use: 2015.1.225 or 2014.3.1209?

Additionally, you need to take into consideration that out-of-the-box the packages are designed to work against fluent models. Using them with .rlinq files is possible (with a lot of modifications and restrictions) but is highly not recommended. You can migrate an .rlinq file to a fluent model with the help of this KB article.

Taken all of the above into account, here are the details and the configuration steps for both NuGet Packages Usage and Installed Version Usage according to your specific circumstances:

The warning and the error appear because the path to Telerik Data Access Enhancer in the .csproj file is not updated after the update of the NuGet packages. This is a problem because each version of Enhancer is designed to work only against the same version of the Data Access assemblies. The general recommendation for avoiding this situation is to restart Visual Studio after upgrading the Data Access packages. Doing so allows the upgrade process to finish properly.

NuGet Packages Usage
1. Open the .csproj file of the model project in a text editor.
2. Locate the following line:
 
<EnhancerAssembly>$(SolutionDir)\packages\Telerik.DataAccess.Fluent.YYYY.Q.MDD.N\tools\enhancer\enhancer.exe</EnhancerAssembly>
where YYYY.Q.MDD.N is the version number. 
Make sure that Enhancer with the version of Data Access you decided to use is available on the specified path.
3. Locate the references to the Data Access assemblies:
<Reference Include="Telerik.OpenAccess">
  <HintPath>..\packages\Telerik.DataAccess.Core.YYYY.Q.MDD.N\lib\net20\Telerik.OpenAccess.dll</HintPath>
</Reference>
<Reference Include="Telerik.OpenAccess.35.Extensions">
  <HintPath>..\packages\Telerik.DataAccess.Core.YYYY.Q.MDD.N\lib\net20\Telerik.OpenAccess.35.Extensions.dll</HintPath>
</Reference>
<Reference Include="Telerik.OpenAccess.Runtime">
  <HintPath>..\packages\Telerik.DataAccess.Core.YYYY.Q.MDD.N\lib\net20\Telerik.OpenAccess.Runtime.dll</HintPath>
</Reference>
and make sure that they are available on the specified hint path and that the version number matches the one of Enhancer.
4. Make sure that the following line is available in the .csproj file:
<Import Project="OpenAccessNuget.targets" />

Once the version numbers match throughout the .csproj file, the project will become buildable again. 

A recommendation about this approach is to integrate the project that consumes the model with the Telerik.DataAccess.Core package.

Installed Version Usage
1. Make sure that Telerik Data Access is installed on your machine.
2. Make sure that all team members are working with one and the same version of Telerik Data Access.
3. Open for edit the .csproj file of the project that holds the model.
4. Make sure that this line is not present in it:
<EnhancerAssembly>$(SolutionDir)\packages\Telerik.DataAccess.Fluent.YYYY.Q.MDD.N\tools\enhancer\enhancer.exe</EnhancerAssembly>
5. Remove the references to the Data Access assemblies.
6. Replace this line:
<Import Project="OpenAccessNuget.targets" />
with this one:
<Import Condition="Exists('$(MSBuildExtensionsPath)\OpenAccess.targets')"
     Project="$(MSBuildExtensionsPath)\OpenAccess.targets" />
7. Save the file.
8. In Visual Studio, re-add the references to the needed Data Access assemblies.

In this case, it is recommended to uninstall the Data Access NuGet packages from the consuming projects and add the references to the assemblies from the install folder of Data Access.

I hope this helps. Let us know if you need further information.


Regards,
Doroteya
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
0
David
Top achievements
Rank 1
answered on 05 Feb 2016, 10:46 PM

Hi, I have a probleme like that but not exactly the same, this is my case:

I have a project and 2 developers working independently using TFS, everything is ok in both computers and projects but when I try publish in a host I received this error. 

 

 

Server Error in '/' Application.

Could not load file or assembly 'Telerik.OpenAccess.Runtime, Version=2015.1.225.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Telerik.OpenAccess.Runtime, Version=2015.1.225.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. The system cannot find the file specified.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Telerik.OpenAccess.Runtime, Version=2015.1.225.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' could not be loaded.

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].

 

 

This only in a form of one developer, the other forms works ok, we are using a old version of data access (installed)
This error is only in the host, don't pass with local running.
Some idea of what is happen? or how solve this?

0
Doroteya
Telerik team
answered on 09 Feb 2016, 12:43 PM
Hi David,

With the default configuration of the projects created with Data Access Q1 2015 (and previous), the error is expected. In order to deploy successfully your application, it has to be configured as described in this blog post.

Let me know how the situation on your side is.

Regards,
Doroteya
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
0
T S
Top achievements
Rank 1
answered on 01 Aug 2016, 04:55 AM

Hi Dooteya

I have try the above upgrade, that is:

1. The earlier version 2015.1.225.1 is installed via downloaded telerik dataaccess.exe.

2. I have use NuGetPackage Manager to upgrade to 2015.2.624.2

3. I encounter the above build error and have try to follow your guide/step.

4. Problem is my .csproj file do not have the line <EnhancerAssembly>$(solutionsDir)..../>

5. Also I try to point to <Import Project="OpenAccessNuget.targets" /> it gove error the target was not found.

I need to upgrade to this version urgently to fix the "select id for insert error".

Thanks

Chen

 

 

Tags
General Discussions
Asked by
Joel
Top achievements
Rank 1
Answers by
Doroteya
Telerik team
David
Top achievements
Rank 1
T S
Top achievements
Rank 1
Share this question
or