<t>I use Visual Studio 2017 and create a new ASP.NET Core project.<br/>
I add migration for Entity Framework Core as below<br/>
<br/>
add-migration "Initial Create"<br/>
<br/>
```<br/>
<br/>
and get the following error:<br/>
<br/>
```<br/>
Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFramework\Add-Migration' for Entity Framework 6.<br/>
Build Failed.<br/>
<br/>
```<br/>
<br/>
Do you know how to resolve this error?<br/>
<br/>
## **UPDATE 1 - March 14, 2017 - Result received after running command**<br/>
<br/>
```<br/>
PM> dotnet ef migrations add "Initial Create"<br/>
<br/>
```<br/>
<br/>
**I see the following output with error message at the end.**<br/>
<br/>
```<br/>
Welcome to .NET Core!<br/>
---------------------<br/>
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.<br/>
<br/>
Telemetry<br/>
--------------<br/>
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The<br/>
data is collected by Microsoft and shared with the community.<br/>
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.<br/>
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.<br/>
<br/>
Configuring...<br/>
-------------------<br/>
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up<br/>
to a minute to complete and will only happen once.<br/>
Decompressing 0%Decompressing 1%Decompressing 2%Decompressing 3%Decompressing 4%<br/>
Decompressing 5%Decompressing 6%Decompressing 7%Decompressing 8%Deco<br/>
mpressing 9%Decompressing 10%Decompressing 11%Decompressing 12%Decompressing 13<br/>
%Decompressing 14%Decompressing 15%Decompressing 16%Decompressing 17%<br/>
Decompressing 18%Decompressing 19%Decompressing 20%Decompressing 21%De<br/>
compressing 22%Decompressing 23%Decompressing 24%Decompressing 25%Decompressin<br/>
g 26%Decompressing 27%Decompressing 28%Decompressing 29%Decompressing 30%<br/>
Decompressing 31%Decompressing 32%Decompressing 33%Decompressing 34%<br/>
Decompressing 35%Decompressing 36%Decompressing 37%Decompressing 38%Decompre<br/>
ssing 39%Decompressing 40%Decompressing 41%Decompressing 42%Decompressing 43%<br/>
Decompressing 44%Decompressing 45%Decompressing 46%Decompressing 47%<br/>
Decompressing 48%Decompressing 49%Decompressing 50%Decompressing 51%Deco<br/>
mpressing 52%Decompressing 53%Decompressing 54%Decompressing 55%Decompressing <br/>
56%Decompressing 57%Decompressing 58%Decompressing 59%Decompressing 60%<br/>
Decompressing 61%Decompressing 62%Decompressing 63%Decompressing 64%<br/>
Decompressing 65%Decompressing 66%Decompressing 67%Decompressing 68%Decompress<br/>
ing 69%Decompressing 70%Decompressing 71%Decompressing 72%Decompressing 73%<br/>
Decompressing 74%Decompressing 75%Decompressing 76%Decompressing 77%<br/>
Decompressing 78%Decompressing 79%Decompressing 80%Decompressing 81%Decomp<br/>
ressing 82%Decompressing 83%Decompressing 84%Decompressing 85%Decompressing 86<br/>
%Decompressing 87%Decompressing 88%Decompressing 89%Decompressing 90%<br/>
Decompressing 91%Decompressing 92%Decompressing 93%Decompressing 94%De<br/>
compressing 95%Decompressing 96%Decompressing 97%Decompressing 98%Decompressin<br/>
g 99%Decompressing 100% 5083 ms<br/>
Expanding 0%Expanding 1%Expanding 2%Expanding 3%Expanding 4%Expanding 5%Ex<br/>
panding 6%Expanding 7%Expanding 8%Expanding 9%Expanding 10%Expanding 11%<br/>
Expanding 12%Expanding 13%Expanding 14%Expanding 15%Expanding 16%Expanding 17%<br/>
Expanding 18%Expanding 19%Expanding 20%Expanding 21%Expanding 22%Expand<br/>
ing 23%Expanding 24%Expanding 25%Expanding 26%Expanding 27%Expanding 28%<br/>
Expanding 29%Expanding 30%Expanding 31%Expanding 32%Expanding 33%Expanding 34<br/>
%Expanding 35%Expanding 36%Expanding 37%Expanding 38%Expanding 39%Ex<br/>
panding 40%Expanding 41%Expanding 42%Expanding 43%Expanding 44%Expanding 45%<br/>
Expanding 46%Expanding 47%Expanding 48%Expanding 49%Expanding 50%Expandin<br/>
g 51%Expanding 52%Expanding 53%Expanding 54%Expanding 55%Expanding 56%<br/>
Expanding 57%Expanding 58%Expanding 59%Expanding 60%Expanding 61%Expanding 62%<br/>
Expanding 63%Expanding 64%Expanding 65%Expanding 66%Expanding 67%Expa<br/>
nding 68%Expanding 69%Expanding 70%Expanding 71%Expanding 72%Expanding 73%<br/>
Expanding 74%Expanding 75%Expanding 76%Expanding 77%Expanding 78%Expanding <br/>
79%Expanding 80%Expanding 81%Expanding 82%Expanding 83%Expanding 84%<br/>
Expanding 85%Expanding 86%Expanding 87%Expanding 88%Expanding 89%Expanding 90%<br/>
Expanding 91%Expanding 92%Expanding 93%Expanding 94%Expanding 95%Expand<br/>
ing 96%Expanding 97%Expanding 98%Expanding 99%Expanding 100% 13884 ms<br/>
<br/>
dotnet : No executable found matching command "dotnet-ef"<br/>
At line:1 char:1<br/>
+ dotnet ef migrations add "Initial Create"<br/>
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br/>
+ CategoryInfo : NotSpecified: (No executable f...and "dotnet-ef":String) [], RemoteException<br/>
+ FullyQualifiedErrorId : NativeCommandError<br/>
<br/>
```<br/>
<br/>
## **UPDATE 2 - March 14, 2017 - Startup.cs**<br/>
<br/>
```<br/>
using Microsoft.AspNetCore.Builder;<br/>
using Microsoft.AspNetCore.Hosting;<br/>
using Microsoft.AspNetCore.Http;<br/>
using Microsoft.EntityFrameworkCore;<br/>
using Microsoft.Extensions.DependencyInjection;<br/>
using Microsoft.Extensions.Logging;<br/>
using Microsoft.Extensions.Configuration;<br/>
using OdeToFood.Services;<br/>
using OdeToFood.Entities;<br/>
using Microsoft.AspNetCore.Routing;<br/>
using Microsoft.AspNetCore.StaticFiles;<br/>
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;<br/>
<br/>
namespace OdeToFood<br/>
{<br/>
public class Startup<br/>
{<br/>
public IConfiguration Configuration { get; set; }<br/>
<br/>
public Startup(IHostingEnvironment env)<br/>
{<br/>
// TN - Read setting files<br/>
var builder = new ConfigurationBuilder()<br/>
.SetBasePath(env.ContentRootPath)<br/>
.AddJsonFile("appsettings.json")<br/>
.AddEnvironmentVariables();<br/>
<br/>
Configuration = builder.Build();<br/>
}<br/>
<br/>
// This method gets called by the runtime. Use this method to add services to the container.<br/>
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940<br/>
public void ConfigureServices(IServiceCollection services)<br/>
{<br/>
services.AddMvc();<br/>
services.AddSingleton(Configuration);<br/>
services.AddSingleton<IGreeter, Greeter>();<br/>
services.AddScoped<IRestaurantData, SqlRestaurantData>(); // TN - One instance of this service for each HTTP request.<br/>
services.AddDbContext<OdeToFoodDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));<br/>
services.AddIdentity<User, IdentityRole>()<br/>
.AddEntityFrameworkStores<OdeToFoodDbContext>();<br/>
}<br/>
<br/>
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.<br/>
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)<br/>
{<br/>
loggerFactory.AddConsole();<br/>
<br/>
if (env.IsDevelopment())<br/>
{<br/>
app.UseDeveloperExceptionPage();<br/>
}<br/>
else<br/>
{<br/>
//app.UseExceptionHandler("/error");<br/>
//app.UseExceptionHandler(new ExceptionHandlerOptions { ExceptionHandlingPath="/error" });<br/>
<br/>
app.UseExceptionHandler(new ExceptionHandlerOptions<br/>
{<br/>
ExceptionHandler = context => context.Response.WriteAsync("Opps!")<br/>
});<br/>
}<br/>
<br/>
//app.UseDefaultFiles();// TN - will pick index.html<br/>
//app.UseStaticFiles();<br/>
<br/>
app.UseFileServer(); // TN - This will include UseDefaultFiles() and UseStaticFiles<br/>
<br/>
/*<br/>
app.UseWelcomePage(new WelcomePageOptions<br/>
{<br/>
Path = "/welcome"<br/>
});<br/>
<br/>
app.Run(async (context) =><br/>
{<br/>
// TN - Read directly from configuration file<br/>
//var message = Configuration["Greeting"];<br/>
<br/>
// TN - Dependency Injection - Read from configuration string via IOC<br/>
var message = greeter.GetGreeting();<br/>
await context.Response.WriteAsync(message);<br/>
});<br/>
*/<br/>
<br/>
app.UseIdentity();<br/>
<br/>
//app.UseMvcWithDefaultRoute();<br/>
app.UseMvc(ConfigureRoutes);<br/>
<br/>
// TN - if no route matches<br/>
app.Run(ctx => ctx.Response.WriteAsync("Not found."));<br/>
}<br/>
<br/>
private void ConfigureRoutes(IRouteBuilder routeBuilder)<br/>
{<br/>
//Home/Index<br/>
routeBuilder.MapRoute("Default",<br/>
"{controller=Home}/{action=Index}/{id?}");<br/>
}<br/>
}<br/>
}<br/>
<br/>
```<br/>
<br/>
**Update 3 - March 14, 2017 - Added csproj file**<br/>
<br/>
```<br/>
<Project Sdk="Microsoft.NET.Sdk.Web"><br/>
<br/>
<PropertyGroup Label="Globals"><br/>
<SccProjectName>SAK</SccProjectName><br/>
<SccProvider>SAK</SccProvider><br/>
<SccAuxPath>SAK</SccAuxPath><br/>
<SccLocalPath>SAK</SccLocalPath><br/>
</PropertyGroup><br/>
<br/>
<PropertyGroup><br/>
<TargetFramework>netcoreapp1.1</TargetFramework><br/>
<PackageTargetFallback>portable-net45+win8</PackageTargetFallback><br/>
</PropertyGroup><br/>
<br/>
<ItemGroup><br/>
<!--<Content Include="wwwroot\index.html" />--><br/>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" /><br/>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" /><br/>
</ItemGroup><br/>
<ItemGroup><br/>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /><br/>
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" /><br/>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" /><br/>
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" /><br/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" /><br/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" /><br/>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" /><br/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" /><br/>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" /><br/>
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" /><br/>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0" /><br/>
</ItemGroup><br/>
<ItemGroup><br/>
<Folder Include="Controllers\" /><br/>
<Folder Include="Data\" /><br/>
<Folder Include="Views\Home\" /><br/>
<Folder Include="wwwroot\images\" /><br/>
</ItemGroup><br/>
<br/>
</Project><br/>
<br/>
```</t>