Web Api Scaffolding - Error starting selected code generator

Summary: When creating a new web project in Visual Studio 2015 (Update 1), im cannot use the underlining tool for controllers related to the Entity Framework.

Same issue with VS2013 5 update

It returns the following message:

An error occurred while starting the code generator:
An error occurred while getting the type "failtest.Models.TestModelClass".

Try rebuilding the project.

I tried to rebuild it, but still nothing.

Has anyone understood why I am getting this? I really reinstalled my Windows 10 system to see if this error resolves. - So, no matter how it was said, in any case, it needed some kind of hard love, so I decided that it was time. Perhaps this is a failure because I have tried a huge amount of node materials in the past and resolution errors. But the error occurred both before and after I installed it again. (full whipe)

This is a new installation of Visual Studio 2015 Professional. Basically, nothing has been added to the system yet.

When I first started this post, I created an empty project for my screenshots to show the whole process (below). And I did not understand that I had lost consciousness.

, . . , , , , , ( ). .

:

  • "Azure Api App". . .

New project

  1. .

Model

  1. ( Microsoft, scaffolder)

  2. , "" . " Web Api 2.0 , Entity Framework"

  1. , , , + .

:

Packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="8.0.2" targetFramework="net452" />
  <package id="Swashbuckle" version="5.3.1" targetFramework="net452" />
  <package id="Swashbuckle.Core" version="5.3.1" targetFramework="net452" />
  <package id="System.IdentityModel.Tokens.Jwt" version="4.0.2.206221351" targetFramework="net452" />
  <package id="WebActivatorEx" version="2.1.0" targetFramework="net452" />
</packages>

Web.Config:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301879
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <appSettings></appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5.2" />
    <httpRuntime targetFramework="4.5.2" />
  </system.web>
  <system.webServer>
    <handlers>
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <remove name="OPTIONSVerbHandler" />
      <remove name="TRACEVerbHandler" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>

EDIT 2: , EntityFramework, scaffolder , EntityFramework.

  • Debug Release
  • XML
  • Verified Web.config
  • /

, -

aspnet Github. https://github.com/aspnet/Tooling/issues/411

Microsoft, Visual Studio.

+4
1

/ .

Panda Antivirus. , Panda , . , .

, , , . , .

. . ~ 20 .

, , scaffolder.

, AV , , , AV.

, - , .

@oleg !

+1

Source: https://habr.com/ru/post/1627207/


All Articles