Using Open Access in Sitefintiy when I have the full product

Posted by Community Admin on 04-Aug-2018 14:03

Using Open Access in Sitefintiy when I have the full product installed

All Replies

Posted by Community Admin on 17-Jun-2012 00:00

I have the Telerik Ultimate collection 2012 Q2 installed on my machine as well as Sitefinity 5.0.

The there is a difference between the versions of Open Access.

I'm trying to create a OA Class library to my solution to use in some custom code that I intend to run on my Sitefinity site.

I know that Sitefinity has to have the references appropriate to ites build, so I thought that the thing to do would be to create my OA Class library and then change the references in it to point to rthe same DLLs that the SitefinityWebSite project uses.

I did that but have found I get an error when I try and build but OA Class Library...

Error 31 Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2012.2.607.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
ExceptionString:
System.IO.FileLoadException: Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2012.2.607.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
File name: 'Telerik.OpenAccess.35.Extensions, Version=2012.2.607.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' ---> System.Exception: The referenced assembly 'c:\MyPath\Telerik.OpenAccess.35.Extensions.dll' has the wrong version; expected Version=2012.2.607.1 but found Version=2011.3.1320.1.
   at Telerik.OpenAccess.SPI.AssemblyProvider.LoadFromReferences(String assemblyName)
   at Telerik.OpenAccess.SPI.AssemblyProvider.RefResolveEventHandler(Object sender, ResolveEventArgs args)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
   at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName)
   at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
   at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun()

How am I supposed to do this?

-- 
Stuart

Posted by Community Admin on 17-Jun-2012 00:00

You aren't...is essentially the problem we ALL face :/  It'll be endless problems (different enhancers, etc) and unsupported so don't even bother. 

I railed on this after the last release in which they shipped it with an internal version of OA not even downloadable from our accounts!  You could only get access to it by installing the full SDK, and then the resulting OA version was only usable inside of sitefinity.

The good news though is the SF teams and OA teams are now working together, so the release cycles are synced.  So when 5.1 hits, it'll ship with Q2 2012 of OA, you'll be fine then.  Until then however I'd revert back to the OA version that SF uses (which should now be available in your account)

...I would hope Ajax, Kendo are also synced, and someone wakes up and also includes a somewhat more recent Reporting version than like Q1-Q2 2011 (or whatever it has).

Posted by Community Admin on 18-Jun-2012 00:00

In all of my years working with Telerik and their products, that's the first case of bass-ackward thinking I've come across.

And that has just killed any hope I had of getting the work done I had planned in the timescale I had promised.

Bvgger!

--
Stuart

Posted by Community Admin on 18-Jun-2012 00:00

You could try assembly binding in the meantime, but I don't know if that'd work...when I sometimes mix OA assembly versions you sometimes get the enhancer version errors...

At least...its fixed now and the release cycles are synced, it'd just be nicer if Sitefinity wasn't +- 3-4 weeks after the latest Q release :/ 

Posted by Community Admin on 18-Jun-2012 00:00

We have built out some of our on controls and some have used OA for data. When a new version of SF came out, it would install the new OA on my system.  When I would go back to compile an older version of our code, I was faced with almost the same thing you are facing now.

What I have done is to keep the old copy of the enhancer and venhancer files from when I installed the SDK. Basically, I keep all of the files that are in the directory where the enhancer files are located. So for each version of OA, I have a folder with the version number in the name of the folder. Then in my projects, I add an "Import" node into the project file just after the MSBuildToolsPath node. This entry is a path to a copy of the OpenAccess.targets file that I save for each version in the folder structure I mentioned above. The OpenAccess.targets file declares all of the needed build options and has a path to the folder. Just change out the path for each version you need to have.

This allows me to go back and make changes to my older versions of the code and compile the project with the older OA. Since we manage a lot of sites with varying versions, we need to be able to compile different versions of our code. So maybe this will help you in moving forward with you development.

Posted by Community Admin on 20-Jun-2012 00:00

Just got bit in the ass by this one while upgrading from 4.4 to 5.0.2860.  I dowloaded and installed the Sitefinity 5 Upgrade and the Sitefinity 5 SDK.  Next, I upgraded my SF project using the steps outlined in the Upgrade Guide, and build my solution.  The result:

Error   1171    Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2011.2.713.3, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
ExceptionString:
System.IO.FileLoadException: Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2011.2.713.3, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500)
File name: 'Telerik.OpenAccess.35.Extensions, Version=2011.2.713.3, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' ---> System.Exception: The referenced assembly 'C:\Program Files (x86)\Telerik\Sitefinity 4.3\Projects\NLG Sitefinity Site\bin\Telerik.OpenAccess.35.Extensions.dll' has the wrong version; expected Version=2011.2.713.3 but found Version=2011.3.1320.1.

Make me wonder how much testing goes into the "Upgrade Installer" given the number of times we run into these types of issues.

Anyone have any insight on how to fix this?

Thanks -- Steve

Posted by Community Admin on 20-Jun-2012 00:00

@SteveV
Try this (in your webconfig under <configuration>:

**EDIT** or just re-compile whatever assemblies you used that reference that openaccess version, make sure their refs are pointing at 2011.3.1320.1 and build them again.

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Telerik.OpenAccess" publicKeyToken="7CE17EEAF1D59342" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2011.3.1320.1" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Telerik.OpenAccess.35.Extensions" publicKeyToken="7CE17EEAF1D59342" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2011.3.1320.1" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

Posted by Community Admin on 20-Jun-2012 00:00

Steve,

Thanks for the very quick reply.  I added the config block you provided under the opening <configuration> tag in my web config.  Alas, no joy--I get the exact same error.

Regarding: "or just re-compile whatever assemblies you used that reference that openaccess version, make sure their refs are pointing at 2011.3.1320.1 and build them again."

That's the wierd part; I have a number of custom modules that are all part of my main Sitefinity project.  The few custom assemblies I am using don't have references to any OpenAccess assemblies.

-- Steve

Posted by Community Admin on 20-Jun-2012 00:00

The thing is, that error only really happens when you have an assembly in there which was compiled under the older version.  It's not really a problem with the upgrade tool, as that can't kick-off a build on the solution.

Have you gone though every project in there and pointed the OA references to the files in the SF bin folder?  You sure there aren't any pointing at the GAC\OA program files install folder, etc etc?

Posted by Community Admin on 20-Jun-2012 00:00

Well, I'm at a complete loss.  My solution only has one project in it.  I've confirmed at all of the references (other than those in the System namespace) point to my solution's bin folder.  I have references to 4 external binaries; 3 from projects under my control, I've opened the 3 projects and confirmed that they have no references to any OpenAccess assemblies and that none of the references in those projects have OpenAccess dependencies.  I've also opened all 4 assemblies in Telerik JustDecompile to confirmed that none of the references include any OpenAccess entries.

Any other thoughts?

Thanks--Steve

Posted by Community Admin on 20-Jun-2012 00:00

...any 3rd party controls in the bin folder that arn't "projects" (per say)?

Posted by Community Admin on 20-Jun-2012 00:00

Yes, there are several:

Facebook.dll (not sure why this is in my bin folder.  Removed - no change)
NHamcrest.dll (not sure why this is in my bin folder. Removed - no change)

*GhostscriptSharp.dll (Dotnet interop wrapper for gsdll64.dll - see below.  Removing causes missing reference errors)
gsdll64.dll (Native dll for GhostScript.  Removed - no change)
*PDFThumbnailer.dll (Used with GhostscriptSharp.dll to create thumbnail images of PDF docs.  Removing causes missing reference errors)
HiQPdf.dll (3rd party PDF document creation library.  Removed - no change)
*NLGTestResources.dll (Used with elearning module.  Removing causes missing reference errors)

The 3 assemblies noted with * are my assemblies from other projects which I have confirmed contain no OpenAccess references. 

Thanks -- Steve

Posted by Community Admin on 21-Jun-2012 00:00

More info:

I created a new SF5 project using the SF Project Manager. 

Next I added all of the the references that are included in the problem project.  Result: compiles fine.

Next, I added the handfull of assemblies listed in my previous post to the new project's bin folder.   Result: compiles fine.

Next, I added all of the folder and source files that are included in the problem project to the new SF5 project.  Result: compiles fine.

As far as I can tell, the folder structure and file content is identical in both projects.  The only noticable difference is the config files: the problem project includes custom control and custom module entries where the new SF5 project a single default config file (ProjectConfig.config). 

Not sure where to go from here since screwing with the config file versions when upgrading is generally frowned upon. 

[EDIT]
For the purposes of isolating the unlikely posibility that the config files were causing the issue, I added all of the config files from the problem project to the new SF5 project.  Result: compliles fine.

Anyone have any thoughts?

Thanks -- Steve

Posted by Community Admin on 21-Jun-2012 00:00

Found the problem.  I don't remember the specifics, but I recall runnning into problems creating custom modules when I first created the project last year.  I came across the following Telerik OpenAccess Developers Guide which included info about importing the OpenAccess.targets:

Import the OpenAccess.targets

The final step is to import the OpenAccess.targets. In order to do this:

  1. Right-click on your project in the Solution Explorer and select Unload Project.
  2. Again in the Solution Explorer, right-click on the unloaded project and select Edit ProjectName.csproj.
  3. In your csproj file, find a line like this one:
    XML  Copy Code
    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    And import the following code after the aforementioned line:
    XML  Copy Code
    <Import Condition="Exists('$(MSBuildExtensionsPath)\OpenAccess.targets')" Project="$(MSBuildExtensionsPath)\OpenAccess.targets" />
  4. Save your changes. Right-click on your project in the Solution Explorer and select Reload Project.

I followed the instructions and the project has been running in a production environment since February of this year. 

Looking at the contents of the MSBuildExtensionPath VS envronment variable (which expands to C:\Program Files (x86)\MSBuild) I see the "OpenAccess.targets" file.  Opening the file in notepad reveals that the "OpenAccessPath" variable points to "C:\Program Files (x86)\Telerik\OpenAccess ORM".  All of the files in the bin folder are older file versions.

Commenting the entry out in my project file eliminated the error and the project now builds fine.  Now on to the rest of the upgrade--hopefully that goes a bit smoother.

--Steve

Posted by Community Admin on 21-Jun-2012 00:00

SteveV,
    In my post earlier I talked about creating a separate folder to hold the files needed for the different versions of OA. The import statement that you added is where you would change the path to folder location that houses the version in which your site is compiled in.

Here is what my import line looks like:
<Import Condition="Exists('D:\Program Files\Telerik\OpenAccess ORM\2011.2.713.3\OpenAccess.targets')" Project="D:\Program Files\Telerik\OpenAccess ORM\2011.2.713.3\OpenAccess.targets" />

Then in the folder for the version, my OpenAccess.targets file looks like the following:
<!--
***********************************************************************************************
Telerik OpenAccess.targets file
 
WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.
WARNING:  DO NOT modify THIS file. It might get overwritten by an update of Telerik OpenAccess ORM.
 
To use the defined targets, add an <Import Project="PATH_TO_THIS_FILE"/> after the
import statement for Microsoft.<LANGUAGE>.targets.
 
This file defines the steps in the standard build process specific projects using OpenAccess.
When included in a project file, the enhancement will be triggered during CoreCompile.
When included in a project file, the database migration will be triggered during PrepareForRun.
 
Copyright (C) 2007-2009 Telerik Inc. All rights reserved.
***********************************************************************************************
-->
 
<Project InitialTargets="Initial" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
    <!--
    Defines the location of the helper assemblies.
    -->
    <PropertyGroup>
        <UseOpenAccessTargets Condition="'$(UseOpenAccessTargets)'==''">true</UseOpenAccessTargets>
        <OpenAccessPath Condition="'$(OpenAccessPath)'==''">D:\Program Files\Telerik\OpenAccess ORM\2011.2.713.3</OpenAccessPath>
        <EnhancerAssembly>$(OpenAccessPath)\enhancer.exe</EnhancerAssembly>
    </PropertyGroup>
 
 
  <!-- This .targets file can be used by updating Microsoft.Common.targets to
         include the line below (as the last import element just before the end project tag)
      <Import Condition="Exists('$(MSBuildExtensionsPath)\OpenAccess.targets')
              Project="$(MSBuildExtensionsPath)\OpenAccess.targets" "/>
     
        $(OpenAccessPath)\enhancer.exe -->
   
  <!-- The below ensures that "OpenAccessDeploy" is available in the VS Build Action dropdown -->
    <ItemGroup>
        <AvailableItemName Include="OpenAccessDeploy" />
  </ItemGroup>
 
    <UsingTask TaskName="OpenAccessEnhancer" AssemblyFile="$(EnhancerAssembly)" />
    <UsingTask TaskName="OpenAccessDeploy" AssemblyFile="$(EnhancerAssembly)" />
    <UsingTask TaskName="OpenAccessClean" AssemblyFile="$(EnhancerAssembly)" />
    <UsingTask TaskName="CurrentProjectDirectory" AssemblyFile="$(EnhancerAssembly)" />
 
    <PropertyGroup>
    <CalculatedAttributeMapping>True</CalculatedAttributeMapping>
    <CalculatedFluentMapping>True</CalculatedFluentMapping>
        <!-- OpenAccessDeployDependsOn deliberately left empty so others can override this -->
        <OpenAccessDeployDependsOn></OpenAccessDeployDependsOn>
        <BuildDependsOn>
            OpenAccessDeploy;
            $(BuildDependsOn)
        </BuildDependsOn>
 
        <!--Clean intermediate resource files during normal clean-->
        <CleanDependsOn>
            $(CleanDependsOn);
            OpenAccessClean;
        </CleanDependsOn>
 
        <!--Execute enhancer right after compile-->
        <OpenAccessEnhancementDependsOn></OpenAccessEnhancementDependsOn>
        <CompileDependsOn>
            $(CompileDependsOn);
            OpenAccessEnhancer;
        </CompileDependsOn>
    </PropertyGroup>
 
    <Target Name="CurrentProjectDirectory">
        <CurrentProjectDirectory>
            <Output ItemName="CurrentDir" TaskParameter="CurrentDirectory" />
        </CurrentProjectDirectory>
        <!--<Message Text="Inside the Telerik.Data.OpenAccess.targets" Importance="low"/>
        <Message Text="Location: @(CurrentDir->'%(Fullpath)')"/>
        <Message Text="Standard Location: $(MSBuildProjectDirectory)"/>-->
    </Target>
 
    <Target Name="OpenAccessDeploy" DependsOnTargets="$(OpenAccessDeployDependsOn)" >
        <OpenAccessDeploy Sources="@(OpenAccessDeploy)" OutputPath="$(OutputPath)">
            <Output TaskParameter="OpenAccessEmbeddedResources" ItemName="EmbeddedResource"/>
      <Output TaskParameter="OpenAccessEmbeddedResources" ItemName="OpenAccessEmbeddedResource"/>
      <!--<Output TaskParameter="RequiresAttributeMapping" PropertyName="CalculatedAttributeMapping"/>-->
        </OpenAccessDeploy>
    </Target>
 
    <Target Name="OpenAccessClean">
        <OpenAccessClean
            Sources="@(OpenAccessDeploy)"
            OutputPath="$(OutputPath)" />
    </Target>
 
    <Target Name="OpenAccessEnhancer">
        <OpenAccessEnhancer VerboseMode="3"
                          Assembly="@(IntermediateAssembly->'%(FullPath)')"
                          XmlMapping="@(OpenAccessEmbeddedResource)"
              AttributeMapping="$(CalculatedAttributeMapping)"
              FluentMapping="$(CalculatedFluentMapping)"
                          KeyFile="$(AssemblyOriginatorKeyFile)"
                          KeyContainer="$(KeyContainerName)"
                    References="@(ReferencePath)"
                    ProjectReferences="@(ProjectReference)"
              TargetFramework="$(TargetFrameworkVersion)">
            <Output TaskParameter="Version" ItemName="EV"/>
        </OpenAccessEnhancer>
        <Touch AlwaysCreate="true"
           Files="$(IntermediateOutputPath)$(TargetName).oa"
           Time="%(IntermediateAssembly.ModifiedTime)" />
        <Message Text="@(EV)" />
    </Target>
   
    <!--Old contents starts here-->
     
    <!--
    Defines the default values for OpenAccess properties.
    -->
    <!--<PropertyGroup>
        <UseMSBuildFlag>false</UseMSBuildFlag>
        <EnhancementRequiredFlag>false</EnhancementRequiredFlag>
        <UpdateDatabaseFlag>false</UpdateDatabaseFlag>
        <EnhancementOutputLevel/>
        <DatabaseMigrationOutputLevel>1</DatabaseMigrationOutputLevel>
        <ConnectionId/>
        <ConfigFile/>
        <DB_URL/>
        <OpenAccessGeneratedScriptFileName/>
    </PropertyGroup>-->
 
 
    <!--
    Defines the names of the auxiliary files for timestamp checking.
    -->
    <!--<ItemGroup>
        <EnhancementInfoFile Include="$(IntermediateOutputPath)$(TargetName).oa"/>
        <DatabaseMigrationInfoFile Include="$(OutputPath)$(TargetName).oa"/>
    </ItemGroup>-->
 
 
    <!--
    Modifies the dependencies to that the OpenAccess tasks are called at the right time during build.
    -->
    <!--<PropertyGroup>
        <CompileDependsOn>
            $(CompileDependsOn);
            CheckOpenAccess;
            OpenAccessEnhancement;
        </CompileDependsOn>
 
        <PrepareForRunDependsOn>
            $(PrepareForRunDependsOn);
            CheckOpenAccess;
            OpenAccessDatabaseMigration;
        </PrepareForRunDependsOn>
 
        <CoreCleanDependsOn>
            $(CoreCleanDependsOn);
            OpenAccessClean;
        </CoreCleanDependsOn>
    </PropertyGroup>-->
 
    <!--
    Declares the OpenAccess specific tasks when needed.
    -->
    <!--<UsingTask TaskName="OpenAccessEnhancer"    
                Condition=" '$(UseOpenAccessTargets)' == 'true' " AssemblyFile="$(VEnhanceAssembly)"/>
    <UsingTask TaskName="OpenAccessProperties"  
                Condition=" '$(UseOpenAccessTargets)' == 'true' " AssemblyFile="$(VEnhanceAssembly)"/>
    <UsingTask TaskName="OpenAccessSchemaTool"  
                Condition=" '$(UseOpenAccessTargets)' == 'true' " AssemblyFile="$(VSchemaAssembly)"/>-->
     
 
    <!--
    Checks the user settings for enhancement / migrate schema to be done.
    -->
    <!--<Target Name="CheckOpenAccess"
            Condition="$(UseOpenAccessTargets)">
        <OpenAccessProperties ProjectFile="$(ProjectFileName)">
            <Output TaskParameter="UseMSBuild" PropertyName="UseMSBuildFlag"/>
            <Output TaskParameter="Enhancing" PropertyName="EnhancementRequiredFlag"/>
            <Output TaskParameter="EnhancementOutputLevel" PropertyName="EnhancementOutputLevel"/>
            <Output TaskParameter="UpdateDatabase" PropertyName="UpdateDatabaseFlag"/>
            <Output TaskParameter="ConnectionId" PropertyName="ConnectionId"/>
            <Output TaskParameter="ConfigFile" ItemName="ConfigFile"/>
        </OpenAccessProperties>
    </Target>-->
 
 
    <!--
    Calls the OpenAccess enhancer tool on the target assembly to enhance the field
    access code for persistence awareness. This is done only when necessary.
    -->
    <!--<Target Name="OpenAccessEnhancement"
            Condition="$(EnhancementRequiredFlag) AND $(UseMSBuildFlag)"
            Inputs="@(IntermediateAssembly)"
            Outputs="@(EnhancementInfoFile)">
        <OpenAccessEnhancer
            VerboseMode="$(EnhancementOutputLevel)"
            Assembly="@(IntermediateAssembly->'%(FullPath)')"
            SignAssembly="$(SignAssembly)"
            KeyFile="$(AssemblyOriginatorKeyFile)"
            KeyContainer="$(KeyContainerName)"
            References="@(ReferencePath)"
            ProjectReferences="@(ProjectReference)">
            <Output TaskParameter="Version" PropertyName="OpenAccessEnhancerVersion" />
        </OpenAccessEnhancer>-->
        <!-- Because we enhance the existing assembly, we must have another file
             to hold the old timestamp. -->
        <!--<Touch AlwaysCreate="true" Files="@(EnhancementInfoFile)"
                                   Time="%(IntermediateAssembly.ModifiedTime)" />
    </Target>-->
     
 
    <!--
    Assures, that the main assembly does exist when it is needed.
    -->
    <!--<Target Name="OpenAccessAssureMainAssembly"
            Condition="$(UpdateDatabaseFlag) AND $(UseMSBuildFlag)">
        <Error Condition="! Exists(@(MainAssembly->'%(FullPath)'))"
            Text="Main Assembly does not exist, but is required for database migration."
            HelpKeyword="OpenAccess Schema Tool" />
    </Target>-->
 
     
    <!--
    Assures, that the database exists. When it does not, attempts to create one with the given name.
    -->
    <!--<Target Name="OpenAccessAssureDatabaseExistence"
            Condition="$(UpdateDatabaseFlag) AND $(UseMSBuildFlag)"
            Inputs="@(IntermediateAssembly)"
            Outputs="@(DatabaseMigrationInfoFile)"
            DependsOnTargets="OpenAccessAssureMainAssembly">
        <OpenAccessSchemaTool
            VerboseMode="$(DatabaseMigrationOutputLevel)"
            Assembly="@(MainAssembly->'%(FullPath)')"
            Config="@(ConfigFile->'%(FullPath)')"
            ConnectionId="$(ConnectionId)"
            DatabaseCreate="true"
            Direct="true"
            DataDirectory="$(ProjectDir)"
            OutputDir="@(OutputPath)"
            References="@(ReferencePath)">
            <Output TaskParameter="ScriptName"  PropertyName="OpenAccessGeneratedScriptFileName"/>
            <Output TaskParameter="DatabaseURL" PropertyName="DB_URL"/>
        </OpenAccessSchemaTool>
        <OnError ExecuteTargets="OpenAccessAssureDatabaseExistenceError" />
    </Target>
    <Target Name="OpenAccessAssureDatabaseExistenceError">
        <Error Text="Check, that the provided username/password allows to create and open the database."
               HelpKeyword="OpenAccess Schema Tool"/>
    </Target>-->
 
 
    <!--
    Calculates the required changes for the database schema. The output parameter of ScriptName contains the
    name of the generated file when changes are necessary.
    -->
    <!--<Target Name="OpenAccessCalculateChanges"
            Condition="$(UpdateDatabaseFlag) AND $(UseMSBuildFlag)"
            Inputs="@(IntermediateAssembly)"
            Outputs="@(DatabaseMigrationInfoFile)"
            DependsOnTargets="OpenAccessAssureDatabaseExistence">
        <OpenAccessSchemaTool
            Migrate="true"
            VerboseMode="$(DatabaseMigrationOutputLevel)"
            Assembly="@(MainAssembly->'%(FullPath)')"
            Config="@(ConfigFile->'%(FullPath)')"
            ConnectionId="$(ConnectionId)"
            Direct="false"
            DataDirectory="$(ProjectDir)"
            OutputDir="@(OutputPath)"
            References="@(ReferencePath)">
            <Output TaskParameter="ScriptName" PropertyName="OpenAccessGeneratedScriptFileName"/>
            <Output TaskParameter="DatabaseURL" PropertyName="DB_URL"/>
        </OpenAccessSchemaTool>
        <OnError ExecuteTargets="OpenAccessCalculateChangesError" />
    </Target>
    <Target Name="OpenAccessCalculateChangesError">
        <Error Text="Check, that the provided username/password allows to read the schema of the database."
               HelpKeyword="OpenAccess Schema Tool"/>
    </Target>-->
 
 
    <!--
    Executes the changes recorded in the generated sql script file to adopt the database schema.
    This will only be done when necessary.
    -->
    <!--<Target Name="OpenAccessDatabaseMigration"
            Condition="$(UpdateDatabaseFlag) AND $(UseMSBuildFlag)"
            Inputs="@(IntermediateAssembly)"
            Outputs="@(DatabaseMigrationInfoFile)"
            DependsOnTargets="OpenAccessCalculateChanges">
        <OpenAccessSchemaTool
            Condition="Exists($(OpenAccessGeneratedScriptFileName))"
            ExecuteSql="true"
            DataDirectory="$(ProjectDir)"
            ScriptName="$(OpenAccessGeneratedScriptFileName)"
            Assembly="@(MainAssembly->'%(FullPath)')"
            Config="@(ConfigFile->'%(FullPath)')"
            ConnectionId="$(ConnectionId)"
            References="@(ReferencePath)">
        </OpenAccessSchemaTool>-->
        <!--
            Because we don't want to migrate the database every time, we do so only when the
            intermediate assembly was freshly build and touch the info file then.
        -->
        <!--<Touch AlwaysCreate="true" Files="@(DatabaseMigrationInfoFile)"
                                   Time="%(IntermediateAssembly.ModifiedTime)" />
        <OnError ExecuteTargets="OpenAccessDatabaseMigrationError" />
    </Target>
    <Target Name="OpenAccessDatabaseMigrationError">
        <Error Text="Check, that the provided username/password allows to open the existing database for schema modification."
               HelpKeyword="OpenAccess Schema Tool"/>
    </Target>-->
 
 
    <!--
    Cleans up files generated by OpenAccess.
    -->
    <!--<Target Name="OpenAccessClean" >
        <Delete Condition="Exists(@(EnhancementInfoFile))" Files="@(EnhancementInfoFile)" />
        <Delete Condition="Exists(@(DatabaseMigrationInfoFile))" Files="@(DatabaseMigrationInfoFile)" />
    </Target>-->
     
  <Target Name="Initial">
     <Message Text="Using definitions of OpenAccess.targets" Importance="normal" />
  </Target>
 
</Project>

So for each version of OA, you would have a folder with the necessary dll's and exe's needed for OA to compile your code. Then you just change the path in your project file and also in the OA targets file to the correct version. This is how we maintain multiple versions of SF and our custom projects.

If your custom module is not using OA, then you can continue as you are. But if it uses OA, you will need to get the latest SDK and build the project using the OA from the SDK. Before you install the new SDK, pull all of the files in the following folder to use in your archived directory structure: "C:\Program Files (x86)\telerik\OpenAccess ORM\sdk"

Posted by Community Admin on 21-Jun-2012 00:00

Hi Richard,

Thanks for your detail reply.  I did read your previous post but since I was upgrading my SF project which also includes the custom modules using OA *and* I had installed the SF SDK which I assumed included the required OA assemblies, I also assumed that all of the OA assemblies would have been updated.

So, after installing the SF SDK it appears that none of the files in the "C:\Program Files (x86)\Telerik\OpenAccess ORM\bin" folder have been updated.  Is it normal that I would need to copy all of the OA files from the SF SDK to the OpenAccess.targets folder?

Also, the OA folder structure (C:\Program Files (x86)\Telerik\OpenAccess ORM) in the SF SDK looks nothing like the OpenAccess.targets folder structure.  Any idea which files and folder I need from the SF SDK OpenAccess--just the bin folder?

Sorry for all the questions but the docs are *** poor at best and mostly non-existant.

My custom modules do use OA so I'm curently stuck with ugly exceptions that look like:

Unable to upgrade database schema metadataSource provided by 'SchoolNotices': No metadata has been registered for class SitefinityWebApp.Modules.SchoolNotices.Data.SchoolNotice. (This usually indicates, that either this class is not declared persistent or it is declared persistent but not enhanced. The class was loaded from file:///C:/Program Files (x86)/Telerik/Sitefinity 4.3/Projects/NLG Sitefinity Site/NLG Sitefinity Site/bin/SitefinityWebApp.DLL.)

So far I've pissed away an entire day and counting dealing with this issue and still don't have the upgraded site running on my dev box--VERY FRUSTRATING.

Thanks again -- Steve

Posted by Community Admin on 21-Jun-2012 00:00

I've never had to copy any of the newer files into the OA directory. I just copy the older files and store them in a secondary location to access for older sites. Once the SDK has been installed, it should update the files with the latest versions. Either the new SF install or the SF SDK install will also install the latest version of OA. (I think it is the SDK) That should copy all of the correct files you would need for the newer version.

I guess I am not following your question about the OA folder structure and OpenAccess.targets.

Posted by Community Admin on 21-Jun-2012 00:00

Sorry--I'm being incoherent.  What I was trying to say is that my "C:\Program Files (x86)\Telerik\OpenAccess ORM" folder structure looks odd.  See that attached "openaccess orm folder.png" screen snip:

I have what appears to be folders from the SF 4.x SDK install dated 11/14/2011 which includes for following folders:
bin
documentation
dsl2008
dsl2010
dsw
sdk
src

There's also another folder named "ProductSdk" with a Date Modified value of 6/20/12 10:44 AM which certainly coincides with the date and time I installed the SF SDK.  The "ProductSdk" folder contents are completly different--see  "openaccess orm_productsdk folder.png".

So the question is which path do I need to point the "OpenAccessPath" variable to in the OpenAccess.target file?

Thanks -- Steve

Posted by Community Admin on 21-Jun-2012 00:00

The path in the OpenAccess.targets file needs to point to the directory in which the enhancer.exe and venhance.exe files are located. On my machine, these files are located in the sdk folder.

Problem here could be the SDK itself. 5.0.2860 is a hotfix for 5.0.2800. The SDk is probably using 5.0.2800 as the build and therefore uses the older OA dlls. You might put in a ticket with SF and see if they have a SDK build for 5.0.2860. Another option would be to try and download OA with that version and install.

Posted by Community Admin on 21-Jun-2012 00:00

Got it sorted out finally.

This was the fix:

<PropertyGroup>
        <UseOpenAccessTargets Condition="'$(UseOpenAccessTargets)'==''">true</UseOpenAccessTargets>
        <OpenAccessPath Condition="'$(OpenAccessPath)'==''">C:\Program Files (x86)\Telerik\OpenAccess ORM\ProductSdk\Content\Common\Dependencies\</OpenAccessPath>
        <EnhancerAssembly>C:\Program Files (x86)\Telerik\OpenAccess ORM\ProductSdk\Content\Common\Dependencies\enhancer.exe</EnhancerAssembly>
    </PropertyGroup>

Note that the paths point to the "C:\Program Files (x86)\Telerik\OpenAccess ORM\ProductSdk\Content\Common\Dependencies" folder rather than the "C:\Program Files (x86)\Telerik\OpenAccess ORM\" root.  Still wondering why I even needed to do ANY of this.

Thanks again for all of the help!
Steve

Posted by Community Admin on 21-Jun-2012 00:00

You can probably use the folder from the SF SDK:
C:\Program Files (x86)\telerik\Sitefinity 5.0\SDK\Content\Common\Dependencies

The folder path may be a little different depending on the install and SF version. The actual OA directory is from and OA install. I think if you use the SDK folder from the OA folder, you may actually need the OA SDK for the version in which you want to use. The SF SDK also gives you the the files needed for compilation as I showed above.

Hopefully that might clear up some confusion.

Posted by Community Admin on 22-Jun-2012 00:00

I'm no stranger to this issue myself, but a while back was able to put together a pretty decent process to work around it.

I fully intended to blog about it but never found the time. However, now that there's so much interest in it from this thread, I decided I should go ahead and push it out.

I published it on the Sitefinity Guru blog: Developing With Sitefinity When A Different Version of OpenAccess is Installed

Hope this is helpful!

Posted by Community Admin on 23-Jun-2012 00:00

Thanks Josh--very helpful.

Posted by Community Admin on 24-May-2013 00:00

Dredging up an old post but just got bit in the ass again upgrading from 5.1 to 5.2 (on my way to 6.0 sp1 via the 5.2>5.4>6.0 upgrade madness).  Telerik no longer offers the older versions of OpenAccess for download so Josh's solution no longer works.  Anyone have any ideas?

Thanks -- Steve

Posted by Community Admin on 29-May-2013 00:00

Hi,

If you are going to upgrade to 6.0 for which the SDK is available to download (as its the latest version) I suggest disabling the module until you upgrade sitefintiy to 6.0, here is a teporary FTP where you can download SDK for 5.2, 5.3, 5.4

Set FTP in Active Mode!
IP address: 82.103.64.22
Username: Sitefintiy51SDK
Password: Ya]$8#R$ok#
------------------------------------------
Please keep in mind that the user account will expire in 15 days and all the files in the client folder will be deleted in 15 days

Regards,
Stanislav Velikov
Telerik

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 01-Jun-2013 00:00

Hi Stanislav,

We have about 10 clients with custom modules we look after, all across various versions and although we try to convince them to stay up with the latest release most won't until they really have to or we build the cost into some other work we do.

This is a major problem and I don't see the logic here as to why Telerik are not providing us permanent access to the SDK dependencies. If you download a SDK for say 5.2 to upload a 5.1 project when you run the installer it says "please use the latest version" and then quits.

What is so hard about maintain a ZIP of JUST the SDK dependencies for each version somewhere under our Telerik accounts so us developers can upgrade our customers? Why the 15 day limit?????? We don't need all the SDK just the dependancies folder.... sounds easy!

Can you raise this with the team. It shouldn't take days to upgrade our customers. On this particular project I am now up to day 5.

Right now I am upgrading a 5.0 to 5.1.3450 and I can't get hold of the right SDK dependancies anywhere!!!!!

I have tried to connect to the FTP that you created to see whether that SDK for 5.1 just happens to be in there and it just times out on getting the dir listing... yep it's on active mode.

Thanks,

Seth

Posted by Community Admin on 01-Jun-2013 00:00

Hi,

Got into the SDK ftp... all that is in there is: Sitefinity_SDK_4.1.1395.1.msi

Has something gone wrong?

Seth

Posted by Community Admin on 01-Jun-2013 00:00

Sorry, but this just ins't practical.  I can't disable all my OpenAccess dependant modules while I do the 3 required upgrades from 5.1>6.0.  Support has suggested I copy my production database to my dev machine, do all of the upgrades on my dev machine then copy everything, including the databse back to my production server.

How is this a viable solution?  All database updates that occur on my production server will be overwritten by the older upgraded version of the database.  This includes ecommerce orders, user specific content changes, etc..  Our site provides users with specialty training videos that qualify for continuing education credits. Videos are served from a CDN and have protected access. The user purchases access to the videos, some of which are several hours long. Once the ecommerce transaction is completed, access to video is automatically added to the user's available digital content along with a test, downloadable materials, etc. The user has 72 access to the video from the time they first start watching it. The user can choose to watch the entire video in one session or across many session so long as they comple the video within 72 hours from the first time they press play.

Since these videos qualify for continuing education credits we must be able to ensure they have watched the video in its entirety. Viewing progress is tracked and stored in the database. The user can "rewind" the video as much as they want but can only "fast foward" up to their maximum viewing progress. Once the user has finished viewing the video, they must take, and pass, an online test. The test can also be taken across multiple session in one session. They are allowed to take the test as many times as is required to pass. Test progress is also tracked in a database record. Once the test is completed it is submitted to our testing body.

Now, imaging what would happen if multiple people purchased access to a training video and started taking the test on the production database while we were performing the upgrade in the off-line version of the same database. Best case, we're looking at perhaps 6 hours to complete the 5.2>5.4>6.0 upgrades, test, and ensure the front and backend pages and content all work properly.

What happens when we copy the offline version back to the production server? All online orders, video viewing progress, test progress, test submissions, etc, that occurred on the production database are now overwritten. Not an acceptable solution.

Support's suggestion was that we monitor changes to the database, then encorporate them into the upgraded database.  Umm, how the hell do I do that? 

Telerik really needs to think about the impact the upgrade process has on its users.  I don't have the tools, time, or budget to continue to upgrade if the process is this convoluted and unreliable.  Read this post is you're curious about my latest "upgrade" experience.

Steve

This thread is closed