Error when following one of the tutorials
When I tried to follow this tutorial: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/adding-model
At the part where I try to add the controller I get the following error (see screenshot).

Note that I can build the project successfully. But cannot add the controller. Not sure if this is a user error, but if not it's a bad bug.
Microsoft Visual Studio Enterprise 2017 RC Visual Studio/15.0.0-RC4+26129.0.d15rel
@danroth27 @mlorbetske
@jgoshi I've seen this error before. Can you try the following:
- Exit/restart VS17 and try to scaffold again.
- If above fails, create a new project with simple model and scaffold.
@jgoshi can you provide the contents of your csproj file? And also the log from the output window if possible?
Exit/restart VS17 and try again failed. Here are the contents from the output window.
D:\dotnetcli\artifacts\win10-x64\stage2\dotnet.exe aspnet-codegenerator --project "C:\Users\jgoshi\documents\visual studio 2017\Projects\MvcMovie\MvcMovie\MvcMovie.csproj" --no-build controller --force --controllerName MoviesController --model MvcMovie.Models.Movie --dataContext MvcMovie.Data.ApplicationDbContext --relativeFolderPath Controllers --referenceScriptLibraries --useDefaultLayout
Command Line: --project C:\Users\jgoshi\documents\visual studio 2017\Projects\MvcMovie\MvcMovie\MvcMovie.csproj --no-build controller --force --controllerName MoviesController --model MvcMovie.Models.Movie --dataContext MvcMovie.Data.ApplicationDbContext --relativeFolderPath Controllers --referenceScriptLibraries --useDefaultLayout
Microsoft (R) Build Engine version 15.1.539.38876
Copyright (C) Microsoft Corporation. All rights reserved.
Command Line: --no-dispatch --port-number 30855 --project C:\Users\jgoshi\documents\visual studio 2017\Projects\MvcMovie\MvcMovie\MvcMovie.csproj --no-build controller --force --controllerName MoviesController --model MvcMovie.Models.Movie --dataContext MvcMovie.Data.ApplicationDbContext --relativeFolderPath Controllers --referenceScriptLibraries --useDefaultLayout --dispatcher-version 1.0.0-msbuild3-final
Finding the generator 'controller'...
Running the generator 'controller'...
Attempting to compile the application in memory with the modified DbContext
Attempting to figure out the EntityFramework metadata for the model and DbContext: Movie
No parameterless constructor was found on 'ApplicationDbContext'. Either add a parameterless constructor to 'ApplicationDbContext' or add an implementation of 'IDbContextFactory
at Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.EntityFrameworkServices.TryCreateContextUsingAppCode(Type dbContextType, Type startupType)
No parameterless constructor defined for this object. StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args) at System.Activator.CreateInstance(Type type)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.<>c__DisplayClass12_3.
Worked with @jgoshi offline. The issue seemed to be a bad package in the local nuget cache. Clearing out the local nuget cache and retrying the scenario worked fine.
This issue is being closed because it has not been updated in 3 months.
We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its recipients. This is a temporary error. The following address(es) deferred:
[email protected] Domain spinthemoose.com has exceeded the max emails per hour (220/200 (110%)) allowed. Message will be reattempted later
------- This is a copy of the message, including all the headers. ------ Received: from github-smtp2-ext6.iad.github.net ([192.30.252.197]:48080 helo=github-smtp2b-ext-cp1-prd.iad.github.net) by cp1164.blacksun.ca with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from [email protected]) id 1eVQg6-0000HM-TV for [email protected]; Sat, 30 Dec 2017 17:36:35 -0600 Date: Sat, 30 Dec 2017 15:36:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1514676975; bh=PwPpJGvwAzW3MUvj20GBOY0E+jrE5bvzxI5xRB52+0Y=; h=From:Reply-To:To:Cc:In-Reply-To:References:Subject:List-ID: List-Archive:List-Post:List-Unsubscribe:From; b=1MKpceCtARNWw7/dJJp7AHY8HKTuezFNsY31JpX1kFv4XPesVsZ4Gm7cQMR7NjVGw K746Bag8uK526g4A5CgljCGJu1qq1dWLqnurFQR3n+hUamEeuesYtzKcqihtmmKV2a Gr4IauExJ3288p34YFjXb9vCTIwCk50rH3ejAgSE= From: "ASP.NET Hello Bot" [email protected] Reply-To: aspnet/Home [email protected] To: aspnet/Home [email protected] Cc: Subscribed [email protected] Message-ID: aspnet/Home/issues/1923/[email protected] In-Reply-To: aspnet/Home/issues/[email protected] References: aspnet/Home/issues/[email protected] Subject: Re: [aspnet/Home] Error when following one of the tutorials (#1923) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_5a4822ef2cafd_12cb3f8044228f2c3852e0"; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: list X-GitHub-Sender: aspnet-hello X-GitHub-Recipient: davidalpert X-GitHub-Reason: subscribed List-ID: aspnet/Home <Home.aspnet.github.com> List-Archive: https://github.com/aspnet/Home List-Post: mailto:[email protected] List-Unsubscribe: mailto:unsub+0000a944c2c697f1755c6a2f88722e5c81b078283c82bd9192cf00000001165fe4ef92a169ce0c388dc0@reply.github.com, https://github.com/notifications/unsubscribe/AACpROm7-DcyzPP0SbtJga_fEcDCInlCks5tFsjvgaJpZM4L1yq6 X-Auto-Response-Suppress: All X-GitHub-Recipient-Address: [email protected]
----==_mimepart_5a4822ef2cafd_12cb3f8044228f2c3852e0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit
This issue is being closed because it has not been updated in 3 months.
We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/aspnet/Home/issues/1923#issuecomment-354574927 ----==_mimepart_5a4822ef2cafd_12cb3f8044228f2c3852e0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
This issue is being closed because it has not been updated in 3 months= .
We apologize if this causes any inconvenience. We ask that if you are = still encountering this issue, please log a new issue with updated inform= ation and we will investigate.
&m=
dash;
You are receiving this because you are subscribed to this thre=
ad.
Reply to this email directly, view it on GitHub, or mute the thread.
----==_mimepart_5a4822ef2cafd_12cb3f8044228f2c3852e0--
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its recipients. This is a temporary error. The following address(es) deferred:
[email protected] Domain spinthemoose.com has exceeded the max emails per hour (221/200 (110%)) allowed. Message will be reattempted later
------- This is a copy of the message, including all the headers. ------ Received: from github-smtp2-ext7.iad.github.net ([192.30.252.198]:51758 helo=github-smtp2a-ext-cp1-prd.iad.github.net) by cp1164.blacksun.ca with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from [email protected]) id 1eVQgA-0000Ha-Hf for [email protected]; Sat, 30 Dec 2017 17:36:38 -0600 Date: Sat, 30 Dec 2017 15:36:18 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1514676978; bh=ghPtx3DWzaVt76pzpu1CuP5qcNn52gACd3ENKso9KS4=; h=From:Reply-To:To:Cc:In-Reply-To:References:Subject:List-ID: List-Archive:List-Post:List-Unsubscribe:From; b=vatYwDOAp3ebUQwfOExf+C6AS4blUzgKIlaUvvJZVtwpcDRf102GUKyL4g/mbMHqX J+ymsIyREuGPJiim2B9Ua3zzbTtqH2iF9X4RRO5QjTvX7xUMtnxlOGe/cvrd/H0j9O 3I/WrfOjWxK2/8b7ocvoQp6RvXCaXh03Kh51RW6w= From: "ASP.NET Hello Bot" [email protected] Reply-To: aspnet/Home [email protected] To: aspnet/Home [email protected] Cc: Subscribed [email protected] Message-ID: aspnet/Home/issue/1923/issue_event/[email protected] In-Reply-To: aspnet/Home/issues/[email protected] References: aspnet/Home/issues/[email protected] Subject: Re: [aspnet/Home] Error when following one of the tutorials (#1923) Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_5a4822f2cd0d0_3cd13f976a148f3431449c7"; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: list X-GitHub-Sender: aspnet-hello X-GitHub-Recipient: davidalpert X-GitHub-Reason: subscribed List-ID: aspnet/Home <Home.aspnet.github.com> List-Archive: https://github.com/aspnet/Home List-Post: mailto:[email protected] List-Unsubscribe: mailto:unsub+0000a944c3123428599329217c920c0411bfde434f94904192cf00000001165fe4f292a169ce0c388dc0@reply.github.com, https://github.com/notifications/unsubscribe/AACpROQ79RQt2QWsEAAguRDa17omkxIJks5tFsjygaJpZM4L1yq6 X-Auto-Response-Suppress: All X-GitHub-Recipient-Address: [email protected]
----==_mimepart_5a4822f2cd0d0_3cd13f976a148f3431449c7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit
Closed #1923.
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/aspnet/Home/issues/1923#event-1405208128 ----==_mimepart_5a4822f2cd0d0_3cd13f976a148f3431449c7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
Closed #1923.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.![]()
----==_mimepart_5a4822f2cd0d0_3cd13f976a148f3431449c7--