Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EF 6 Model Template Fails + Designer broken w/ new v2017 MSBuild Configurations. #485

Closed
Latency opened this issue Mar 5, 2018 · 1 comment

Comments

@Latency
Copy link

Latency commented Mar 5, 2018

Unable to create new EF Model from template without errors && unable to modify entities within designer after converting to new MSBuild v2017 configurations.

Possible reason, build action does not exist for .edmx

Availability:

Missing a template for ADO.NET Entity Data Model within Core || Standard projects.
Does full support even exist for these platforms and is there a template available?
EntityDeploy build action not available!!!

Steps to Reproduce

  1. Create new Core API library project...
  2. Change framework from (netcoreapp2.0 || netstandard2.0) -> net461.
  3. Add new project item -> ADO.NET Entity Data Model -> Empty EF Designer Model
  4. CRASHES

Files Created:

.edmx
.edmx.diagram

Will not generate a Context.tt file automatically.
Forcing build rules found below to match hierarchy!

Designer Test:

  1. Add 2 entities.
  2. Draw an association between them.
  3. Select edmx
  4. Add Custom Tool in properties -> 'EntityModelCodeGenerator'
  5. Save model.

Inspect files to be generated in solution explorer (hidden files even).
-- Result--:
No files are auto-generated.

Log:

=====================
3/5/2018 9:47:00 AM
Recoverable
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.VisualStudio.ProjectSystem.ProjectException: The item type 'EntityDeploy' is not supported by this project item provider.
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorUtilities.ThrowProjectExceptionHelper(Exception innerException, String unformattedMessage, Object[] args)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorUtilities.ThrowProjectException(String message, Object arg0)
   at Microsoft.VisualStudio.ProjectSystem.CpsProjectItem`1.<SetItemTypeAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.PropertyPages.PageItemTypeProperty.<SetValueAsStringAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.DynamicTypeBrowseObject.<>c__DisplayClass112_0.<<VSLangProj80-FileProperties2-set_ItemType>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass550_0.<<Mutate>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously(Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.Mutate(Func`1 asyncAction, Boolean includesFileSystemChange, String telemetryActivity)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.DynamicTypeBrowseObject.VSLangProj80.FileProperties2.set_ItemType(String value)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.Automation.OAPropertyInfo.set_Value(Object value)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.ModelObjectItemWizard.RunFinished()
   at Microsoft.VisualStudio.TemplateWizard.Wizard.Execute(Object application, Int32 hwndOwner, Object[]& ContextParams, Object[]& CustomParams, wizardResult& retval)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.RunWizard(SimpleHierarchyNode parentNode, String itemName, String wizardToRun, IntPtr dlgOwner)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<AddItemWithSpecificAsync>d__592.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass457_0.<<AddItem>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously[T](Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass549_0.<HrInvoke>b__0()
   at Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(Func`1 action, IServiceProvider vsShellServiceProvider, IProjectFaultHandlerService projectFaultHandlerService, UnconfiguredProject project)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>b__0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
===================

.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net461</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="EntityFramework.Triggers" Version="6.1.1" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="System.Security" />
  </ItemGroup>

</Project>

Package Dependencies:

These appear to be correct from .nupkg build.

  1. CoContra (1.0.2)

  2. EntityFramework (6.1.3)

  3. EntityFramework.TypedOriginalValues (1.1.1)

  4. EntityFramework.Triggers.dll


No build action for EntityDeploy available for designer!!!

Workaround compiles but designer fails:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Library</OutputType>
    <TargetFrameworks>net461</TargetFrameworks>
    <RootNamespace>POCO</RootNamespace>
    <AssemblyName>Entities</AssemblyName>
    <Version>1.0.1</Version>
    <RepositoryType>GIT</RepositoryType>
    <Company />
    <Product />
    <Authors />
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="Entities\Converters\Transaction.cs" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="Entities\_Designers_\Database\Database.edmx.sql" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="EntityFramework.Triggers" Version="6.1.1" />
    <PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  
  <ItemGroup>
    <EntityDeploy Update="Entities\_Designers_\Database\Database.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>Database.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  
  <ItemGroup>
    <Compile Update="**\_Designers_\Database\*.cs" DesignTime="True" AutoGen="True" DependentUpon="Database.tt" />
    <Compile Update="**\_Designers_\Database\Database.Designer.cs" AutoGen="True" SubType="Designer" DependentUpon="Database.edmx" />
    <Compile Update="**\Settings.Designer.cs" AutoGen="True" SubType="Designer" DependentUpon="Settings.settings" />
  </ItemGroup>

  <ItemGroup>
    <None Update="Entities\_Designers_\Database\Database.Context.tt">
      <Generator>TextTemplatingFileGenerator</Generator>
      <LastGenOutput>Database.Context.cs</LastGenOutput>
    </None>
    <None Update="Entities\_Designers_\Database\Database.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
    </None>
    <None Update="Entities\_Designers_\Database\Database.tt">
      <Generator>TextTemplatingFileGenerator</Generator>
      <LastGenOutput>Database.cs</LastGenOutput>
    </None>
    <None Update="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
    </None>
    <None Update="Entities\_Designers_\Database\Database.edmx.diagram">
      <DependentUpon>Database.edmx</DependentUpon>
      <Generator></Generator>
    </None>
  </ItemGroup>

  <ItemGroup>
    <Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
  </ItemGroup>

  <ItemGroup>
    <Compile Update="Entities\_Designers_\Database\Database.Context.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>Database.Context.tt</DependentUpon>
    </Compile>
    <Compile Update="Entities\_Designers_\Database\Database.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>Database.tt</DependentUpon>
    </Compile>
  </ItemGroup>

</Project>
@Latency Latency changed the title EF 6 Model Template Fails + doesn't generate code w/ new v2017 MSBuild Configurations. EF 6 Model Template Fails + Designer broken w/ new v2017 MSBuild Configurations. Mar 5, 2018
@ajcvickers
Copy link
Member

Duplicate of #189

@ajcvickers ajcvickers marked this as a duplicate of #189 Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants