简体   繁体   中英

Visual Studio 2017 Scaffolding issue with oData service

I am using VS 2017 and trying to create "Web API 2 OData v3 Controller with actions, using Entity Framework". This was working without issue earlier.

Today when I tried it, it failed with below error message.

Object reference not set to an instance of an object.

在此处输入图片说明

I followed below steps but it did not worked,

  1. Delete folder C:\\Users\\userlogin\\AppData\\Local\\Microsoft\\VisualStudio
  2. Delete folder C:\\Users\\userlogin\\AppData\\Local\\Microsoft\\VSCommon
  3. run command devenv /resetuserdata

Is there a way to get the actual error or am I missing something?

After going through below thread I felt that issue is with Entity Framework and when I looked at Entity Framework, found that I was using "6.1.3" version whereas latest version is "6.2.0". When I updated to latest version everything started working as expected.

"There was an error running the selected code generator" in VS 2013 scaffolding

After trying a number of solutions recommended on a different SO post (link coming shortly) I finally settled in on my issue:

My business entities project and by EF context projects were my first attempt to use .NET Standard

My web app was a .NET Framework app. Getting rid of the .NET Standard projects allowed everything to work (I converted them to traditional .NET Framework projects)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM