Custom Content type not creating datatable

Posted by Community Admin on 04-Aug-2018 17:43

Custom Content type not creating datatable

All Replies

Posted by Community Admin on 10-Mar-2015 00:00

I created a custom content type using this tutorial(docs.sitefinity.com/extend-sitefinity-data-model-create-the-custom-type-class). The custom type is part of a custom module created using thunder. My understanding is that openaccess would create a data table to store the custom type however this is not happening.  So when I try to create a new item the error "The "OpenAccessEnhancer" task could not be loaded from the assembly '' " because the enhancer.exe file is not located.   

 

The project is using Sitefinity 7.2.5320.0 and OpenAccess 2014.2.918.1. OpenAccess was installed from Nuget.  I have made a the suggested edits to the .csproj file to reference the OpenAccessNuget.targets file, code below. However, I think I am missing something 

 

 OpenAccessNuget.targets  file

<Project xmlns="schemas.microsoft.com/.../2003">
  <!-- Default values of the Project Settings used in the enhancement process -->
  <PropertyGroup>
    <UseXmlMapping Condition="'$(UseXmlMapping)'==''">false</UseXmlMapping>
    <UseAttributeMapping Condition="'$(UseAttributeMapping)'==''">false</UseAttributeMapping>
    <UseFluentMapping Condition="'$(UseFluentMapping)'==''">true</UseFluentMapping>
    <EnhancerAssembly Condition="'$(EnhancerAssembly)'==''">$(SolutionDir)\packages\Telerik.DataAccess.Fluent.2014.2.918.1\tools\enhancer\enhancer.exe</EnhancerAssembly>
    <EnhancerVerboseMode Condition="'$(EnhancerVerboseMode)'==''">3</EnhancerVerboseMode>
    <Use64BitEnhancer Condition="'$(Use64BitEnhancer)'=='' And '$(PlatformTarget)'=='x64'">true</Use64BitEnhancer>
    <ValidateMapping Condition="'$(ValidateMapping)'==''">false</ValidateMapping>
  </PropertyGroup>

  <!-- Register the enhancement tasks from the enhancer assembly -->
  <UsingTask TaskName="OpenAccessDeploy" AssemblyFile="$(EnhancerAssembly)" Condition="'$(UseXmlMapping)'=='true'"/>
  <UsingTask TaskName="OpenAccessClean" AssemblyFile="$(EnhancerAssembly)"  Condition="Exists('$(EnhancerAssembly)')" />
  <UsingTask TaskName="OpenAccessEnhancer" AssemblyFile="$(EnhancerAssembly)" Condition="'$(Use64BitEnhancer)'!='true'"/>
  <UsingTask TaskName="OpenAccessValidateMapping" AssemblyFile="$(EnhancerAssembly)"  Condition="'$(ValidateMapping)'=='true'"/>

  <ItemGroup>
    <!-- Include a flag for checking if enhancement is needed -->
    <EnhancementFlagFile Include="$(IntermediateOutputPath)$(TargetName).oa" />
  </ItemGroup>

  <ItemGroup Condition="'$(UseXmlMapping)'=='true'">
    <!-- Ensure "OpenAccessDeploy" is available in the Visual Studio Build Action dropdown -->
    <AvailableItemName Include="OpenAccessDeploy" />
  </ItemGroup>

  <!-- Include the OpenAccess ORM tasks in the build process -->
  <PropertyGroup>
    <OpenAccessDeployDependsOn>
      OpenAccessEnhancerCheck;
    </OpenAccessDeployDependsOn>
    <BuildDependsOn Condition="'$(UseXmlMapping)'=='true'">
      OpenAccessDeploy;
      $(BuildDependsOn)
    </BuildDependsOn>

    <OpenAccessCleanDependsOn>
      OpenAccessEnhancerCheck;
    </OpenAccessCleanDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      DeleteEnhancementFlag;
    </CleanDependsOn>
    <CleanDependsOn Condition="Exists('$(EnhancerAssembly)')">
      $(CleanDependsOn);
      OpenAccessClean;
    </CleanDependsOn>

    <OpenAccessEnhancerDependsOn>
      OpenAccessEnhancerCheck;
    </OpenAccessEnhancerDependsOn>
    <CompileDependsOn>
      $(CompileDependsOn);
      OpenAccessEnhancer;
    </CompileDependsOn>

    <OpenAccessValidateMappingDependsOn>
      ValidateMappingCheck;
    </OpenAccessValidateMappingDependsOn>
    <CompileDependsOn Condition="'$(ValidateMapping)'=='true'">
      $(CompileDependsOn);
      OpenAccessValidateMapping;
    </CompileDependsOn>
  </PropertyGroup>

  <!-- The OpenAccessDeploy task prepares the RLINQ files (if any) from the current project for the enhancement process -->
  <Target Name="OpenAccessDeploy" DependsOnTargets="$(OpenAccessDeployDependsOn)">
    <OpenAccessDeploy Sources="@(OpenAccessDeploy)" OutputPath="$(OutputPath)">
      <Output TaskParameter="OpenAccessEmbeddedResources" ItemName="OpenAccessEmbeddedResource" />
      <Output TaskParameter="OpenAccessEmbeddedResources" ItemName="EmbeddedResource" />
    </OpenAccessDeploy>
  </Target>

  <!-- The command line arguments of the enhancer.exe used for enhancing 64 bit assemblies -->
  <PropertyGroup Condition="'$(Use64BitEnhancer)'=='true'">
    <XmlMappingResourcesArg Condition="'$(UseXmlMapping)'=='true'"> -xmlMapping:"@(OpenAccessEmbeddedResource)"</XmlMappingResourcesArg>
    <AttributesMappingArg Condition="'$(UseAttributeMapping)'=='true'"> -attributeMapping</AttributesMappingArg>
    <FluentMappingArg Condition="'$(UseFluentMapping)'=='true'"> -fluentMapping</FluentMappingArg>
    <EnhancerMappingArgs Condition="'$(EnhancerMappingArgs)'==''">$(XmlMappingResourcesArg)$(AttributesMappingArg)$(FluentMappingArg)</EnhancerMappingArgs>
    <KeyFileArg Condition="'$(AssemblyOriginatorKeyFile)'!=''"> -keyFile:"$(AssemblyOriginatorKeyFile)"</KeyFileArg>
    <KeyContainerArg Condition="'$(KeyContainerName)'!=''"> -keyContainer:"$(KeyContainerName)"</KeyContainerArg>
    <ReferencesArgs Condition="'$(ReferencesArgs)'==''"> -reference:"@(ReferencePath,'" -reference:"')"</ReferencesArgs>
    <AdditionalEnhancerArgs Condition="'$(AdditionalEnhancerArgs)'==''">$(EnhancerMappingArgs)$(KeyFileArg)$(KeyContainerArg)$(ReferencesArgs)</AdditionalEnhancerArgs>
  </PropertyGroup>

  <!-- The OpenAccessEnhancer task enhances the project assembly with the OpenAccess ORM specific code -->
  <Target Name="OpenAccessEnhancer" DependsOnTargets="$(OpenAccessEnhancerDependsOn)" Inputs="@(IntermediateAssembly-&gt;'%(FullPath)')" Outputs="@(EnhancementFlagFile)">
    <Exec Condition="'$(Use64BitEnhancer)'=='true'" IgnoreExitCode="false"
      Command="&quot;$(EnhancerAssembly)&quot; -verboseMode:$(EnhancerVerboseMode) -assembly:&quot;@(IntermediateAssembly-&gt;'%(FullPath)')&quot;$(AdditionalEnhancerArgs)" />
    <OpenAccessEnhancer Condition="'$(Use64BitEnhancer)'!='true'"
        VerboseMode="$(EnhancerVerboseMode)"
        Assembly="@(IntermediateAssembly-&gt;'%(FullPath)')"
        XmlMapping="@(OpenAccessEmbeddedResource)"
        AttributeMapping="$(UseAttributeMapping)"
        FluentMapping="$(UseFluentMapping)"
        KeyFile="$(AssemblyOriginatorKeyFile)"
        KeyContainer="$(KeyContainerName)"
        References="@(ReferencePath)"
        TargetFramework="$(TargetFrameworkVersion)" >
      <Output TaskParameter="Version" ItemName="EnhancerVersion" />
    </OpenAccessEnhancer>
    <Touch AlwaysCreate="true" Files="@(EnhancementFlagFile)" Time="%(IntermediateAssembly.ModifiedTime)" />
    <Message Text="The project was successfully enhanced by Telerik OpenAccess ORM Enhancer @(EnhancerVersion)" />
  </Target>

  <!-- The OpenAccessClean task deletes OpenAccess related files if any -->
  <Target Name="OpenAccessClean" DependsOnTargets="$(OpenAccessCleanDependsOn)">
    <OpenAccessClean Sources="@(OpenAccessDeploy)" OutputPath="$(OutputPath)" />
  </Target>
  
  <!-- Deletes the enhancement flag file if exists -->
  <Target Name="DeleteEnhancementFlag">
    <Delete Condition="Exists(@(EnhancementFlagFile))" Files="@(EnhancementFlagFile)" />
  </Target>

  <!-- The OpenAccessValidateMapping task executes a compile time validation of the mapping of your model -->
  <Target Name="OpenAccessValidateMapping" DependsOnTargets="$(OpenAccessValidateMappingDependsOn)">
    <OpenAccessValidateMapping
       Assembly="@(IntermediateAssembly->'%(FullPath)')"
       References="@(ReferencePath)"/>
  </Target>

  <!-- Check if the OpenAccessValidateMapping task can be executed. -->
  <Target Name="ValidateMappingCheck">
    <Message Text="Validating if the OpenAccessValidateMapping task can be executed." Importance="normal" />
    <Error Text="The OpenAccessValidateMapping task cannot be executed because the OpenAccess ORM model is in 64 bit assembly. Please change the platform target of the assembly or disable the ValidateMapping property located top in your '$(MSBuildProjectFullPath)' project file and restart Visual Studio."
           Condition="'$(ValidateMapping)'=='true' And '$(Use64BitEnhancer)'=='true'" />
  </Target>

  <!-- Check if the OpenAccess ORM enhancer assembly can be found at the specified location -->
  <Target Name="OpenAccessEnhancerCheck">
    <Message Text="Validating the existence of the OpenAccess ORM enhancer assembly." Importance="normal" />
    <Error Text="OpenAccessNuget.targets file points to a wrong enhancer location ($(EnhancerAssembly)). Please set a proper value of the 'EnhancerAssembly' property located top in your '$(MSBuildProjectFullPath)' project file and restart Visual Studio."
           Condition="!Exists('$(EnhancerAssembly)') AND !Exists('$(MSBuildThisFileDirectory)\$(EnhancerAssembly)') AND '$(MSBuildThisFileDirectory)' != ''" />
  </Target>
</Project>

---------------------------------------------------------------------------------- 

 

Project file markup 

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="schemas.microsoft.com/.../2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>35719F61-DD73-4490-B7D9-1B440422BE4F</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>MedicalTeams.Custom</RootNamespace>
    <AssemblyName>MedicalTeams.Custom</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <EnhancerAssembly>$(SolutionDir)\packages\Telerik.DataAccess.Fluent.2014.2.918.1\tools\enhancer\enhancer.exe</EnhancerAssembly>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup>
    <PdbFile>$(OutDir)\$(AssemblyName).pdb</PdbFile>
    <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
    <PrepareForRunDependsOn>
      $(PrepareForRunDependsOn);
      EnhanceAssembly;
      <!-- PeVerify --></PrepareForRunDependsOn>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Microsoft.Xrm.Client">
      <HintPath>Dependencies\CRM2011\Microsoft.Xrm.Client.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Xrm.Sdk">
      <HintPath>Dependencies\CRM2011\Microsoft.Xrm.Sdk.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.ServiceModel" />
    <Reference Include="System.ServiceModel.Web" />
    <Reference Include="System.Web" />
    <Reference Include="System.Web.ApplicationServices" />
    <Reference Include="System.Web.Extensions" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="Telerik.OpenAccess">
      <HintPath>..\packages\Telerik.DataAccess.Core.2014.2.918.1\lib\net40\Telerik.OpenAccess.dll</HintPath>
    </Reference>
    <Reference Include="Telerik.OpenAccess.35.Extensions">
      <HintPath>..\packages\Telerik.DataAccess.Core.2014.2.918.1\lib\net40\Telerik.OpenAccess.35.Extensions.dll</HintPath>
    </Reference>
    <Reference Include="Telerik.OpenAccess.40.Extensions, Version=2014.2.918.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\packages\Telerik.DataAccess.Core.2014.2.918.1\lib\net40\Telerik.OpenAccess.40.Extensions.dll</HintPath>
    </Reference>
    <Reference Include="Telerik.OpenAccess.Runtime">
      <HintPath>..\packages\Telerik.DataAccess.Core.2014.2.918.1\lib\net40\Telerik.OpenAccess.Runtime.dll</HintPath>
    </Reference>
    <Reference Include="Telerik.Sitefinity">
      <HintPath>Dependencies\Sitefinity 7.2\Telerik.Sitefinity.dll</HintPath>
    </Reference>
    <Reference Include="Telerik.Sitefinity.Model">
      <HintPath>Dependencies\Sitefinity 7.2\Telerik.Sitefinity.Model.dll</HintPath>
    </Reference>
    <Reference Include="Telerik.Sitefinity.Utilities">
      <HintPath>Dependencies\Sitefinity 7.2\Telerik.Sitefinity.Utilities.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Configuration\CRMSettings.cs" />
    <Compile Include="Configuration\MedicalTeamsConfig.cs" />
    <Compile Include="CustomDataProvider.cs" />
    <Compile Include="CustomManager.cs" />
    <Compile Include="CustomModule.cs" />
    <Compile Include="CustomInstaller.cs" />
    <Compile Include="CustomResources.cs" />
    <Compile Include="Data\DynamicsCRM\DataContext.cs" />
    <Compile Include="Data\OpenAccess\DataProviders\EventSponsorDataProvider.cs" />
    <Compile Include="Data\OpenAccess\Mappings\EventSponsorMapping.cs" />
    <Compile Include="Data\OpenAccess\MetaDataSources\EventSponsorMetaDataSource.cs" />
    <Compile Include="Models\EventSponsor.cs" />
    <Compile Include="Models\EventSponsorBilling.cs" />
    <Compile Include="Models\EventSponsorship.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Widgets\Page\Events\BillingInfomation.cs" />
    <Compile Include="Widgets\Page\Events\Designer\BillingInfomationDesigner.cs" />
    <Compile Include="Widgets\Page\Events\Designer\EventSponsorContactDesigner.cs" />
    <Compile Include="Widgets\Page\Events\EventSponsorContact.cs" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="BasicSettings\readme.txt" />
    <Content Include="Configuration\readme.txt" />
    <Content Include="Dependencies\CRM2011\Microsoft.Xrm.Client.dll" />
    <Content Include="Dependencies\CRM2011\Microsoft.Xrm.Sdk.dll" />
    <Content Include="FieldControls\readme.txt" />
    <Content Include="Web\Scripts\readme.txt" />
    <Content Include="Web\Scripts\Services\readme.txt" />
    <EmbeddedResource Include="Widgets\Page\Events\EventSponsorContact.ascx">
      <SubType>ASPXCodeBehind</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="Widgets\Page\Events\Designer\EventSponsorContactDesigner.ascx">
      <SubType>ASPXCodeBehind</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="Widgets\Page\Events\Designer\EventSponsorContactDesigner.js" />
    <Content Include="Web\UI\readme.txt" />
    <Content Include="Widgets\Form\readme.txt" />
    <Content Include="Widgets\Layout\readme.txt" />
    <EmbeddedResource Include="Widgets\Page\Events\BillingInfomation.ascx" />
    <EmbeddedResource Include="Widgets\Page\Events\Designer\BillingInfomationDesigner.ascx" />
    <EmbeddedResource Include="Widgets\Page\Events\Designer\BillingInfomationDesigner.js" />
    <Content Include="Widgets\Page\readme.txt" />
  </ItemGroup>
  <ItemGroup>
    <None Include="OpenAccessNuGet.targets">
      <SubType>Designer</SubType>
    </None>
    <None Include="packages.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Condition="Exists('$(MSBuildExtensionsPath)\OpenAccessNuget.targets')" Project="$(MSBuildExtensionsPath)\OpenAccessNuget.targets" />
 
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

 

 Thank you in advance for any assistance. 

This thread is closed