I wrote an API in .NET Core that works great when I run locally, but deploying to Azure or Heroku gives me the same error in my logs: No executable found matching command "dotnet-./..dll". I've included my project.json below, I'm not sure what other information would be helpful. Thanks!
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.0",
"Microsoft.EntityFrameworkCore.Design": {
"version": "1.0.0-preview2-final",
"type": "build"
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"tooling": {
"defaultNamespace": "Tokens_monolith"
}
}
The issue here was that the dll files in .bin folder were named differently than the parent folder name. I added this line to my project.json file:
"buildOptions": {
"outputName": "whatever-you-want-it-to-be"
}
I re-built my app and everything seems to be working great. All of the dll file names were changed so I re-deployed to the server. Hope this helps!
Related
I am new in entity framework core and I want to use entity framework core in asp.net core. But when I do add-migration firstMigration it always show below error :
Invalid JSON file in D:\OwnLearnings\EFCore\AspNetCore_EFCore_001\src\AspNetCore_EFCore_001\project.json
Project.json :
{
"dependencies": {
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
I unable to find what is the error. I am facing this type of problem first time in entity framework. Thanks in advance.
Are you missing a reference to the Entity framework package in the dependencies:
"Microsoft.EntityFrameworkCore": "1.0.0"
Also you need the imports for EF Core for executing migrations and updates (command line). This needs to be in the tools seciton (the tools reference also needs to be in the dependencies like you put it, do not remove it)
"dependencies": {
...
},
"tools": {
..,
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"Imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
}...
Hi everyone I've the problem with EFCore migration in project on ASP.NET Core.
Some technical info:
OS: macOS
dotnet --version
1.0.0-preview2-003148
Here is my project.json:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Logging": "1.1.0-preview1-final",
"Microsoft.Extensions.Logging.Console": "1.1.0-preview1-final",
"Microsoft.Extensions.Logging.Debug": "1.1.0-preview1-final",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.EntityFrameworkCore": "1.1.0-preview1-final",
"Microsoft.Extensions.Logging.Abstractions": "1.1.0-preview1-final",
"Npgsql.EntityFrameworkCore.PostgreSQL": "1.0.2",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview3-final",
"Microsoft.EntityFrameworkCore.Design": {
"type": "build",
"version": "1.1.0-preview1-final"
},
"Npgsql.EntityFrameworkCore.PostgreSQL.Design": "1.0.2"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview3-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
],
"buildOptions": {
"emitEntryPoint": true
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [
"dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
]
},
"tooling": {
"defaultNamespace": "TTT"
}
}
I launch "dotnet ef" command from project.json folder.
My actions:
1) dotnet restore
2) dotnet ef
After that I get this error: "No executable found matching command "dotnet-ef".
I have static "Main" method in Program class (Program.cs).
Does anyone have an idea what I am doing wrong?
Thanks.
You need to add "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final" to the tools section.
See https://blogs.msdn.microsoft.com/dotnet/2016/10/25/announcing-entity-framework-core-1-1-preview-1/ for more info
Version 1.1.0 was released today, so the correct version to add in project.json now is 1.1.0-preview4-final:
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final"
}
I have a project that builds and runs fine locally. However, it is failing to build when I push it up to my server (Windows Server 2012 R2). It does not give me any detail as to why it is failing. Even when I add the verbose flag.
PS C:\projectroot> dotnet -v build
Telemetry is: Enabled
Object reference not set to an instance of an object.
I don't see anything in the event logs. Is there anywhere else I can look for error info to get this narrowed down? Any other ideas?
I suspect it may be some missing dependency since it works locally, but don't know where to look next to figure it out.
Here's a copy of my project.json. I tried several combinations of things before arriving at the workaround of building the projects individually.
{
"webroot": "wwwroot",
"userSecretsId": "secret",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNetCore.Mvc.Core": "1.0.1",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
"Microsoft.AspNetCore.Identity": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.Configuration.Abstractions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.EntityFrameworkCore": "1.0.1",
"AutoMapper": "4.1.1",
"MyApp.Domain": "1.0.0-*",
"MyApp.Configuration": "1.0.0-*",
"MyApp.Data": "1.0.0-*",
"MyApp.Data.EF6": "1.0.0-*",
"MyApp.Services": "1.0.0-*",
"MyApp.Services.ETL": "1.0.0-*",
"Scrutor": "1.3.1",
"System.Linq": "4.0.0",
"HtmlSanitizer": "3.2.105",
"Microsoft.AspNet.Identity.Core": "2.2.1",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.EntityFrameworkCore.Design": {
"type": "build",
"version": "1.0.0-preview2-final"
},
"Microsoft.EntityFrameworkCore.Tools": {
"type": "build",
"version": "1.0.0-preview2-final"
}
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net461": {
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views/**/*.cshtml",
"web.config",
"config.json",
"logs",
"Aspose.Pdf.lic"
]
},
"scripts": {
"prepublish": [
"npm install",
"bower install",
"gulp clean",
"gulp min"
],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
}
}
Did you attempt to clean the project before running? Because the "cached" files when building in your own laptop/workstation might have been reused on the server.
In your project.json,
I noticed that you're using the 461 framework. Not sure if .NET Core uses that too because I've always been using this
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
ASP.NET MVC Core No executable found matching command "dotnet-bundle"
I see the following in the Output Window when I Build my MVC Core WebApp. I can run my app with localhost and everything works well. This message at this time doesn't affect me on my localhost. Is this something that I should be concerned with when I publish my app?
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Publishing.targets(149,5): Error : No executable found matching command "dotnet-bundle"
Here's my project.json details...
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.SqlServer.Design": {
"version": "1.0.1",
"type": "build"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"Views",
"Views/**/*.cshtml",
"Areas/**/Views",
"Areas/**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Here's the answer to this question:
In tools section of package.json add this-
"tools": {
"BundlerMinifier.Core": "2.2.281",
same question here
tools setting in package.json
BundlerMinifier.Core
one more thing to add is that after adding the BundlerMinifier.Core to the tools section in package.json file if you are using Visual Studio 2015 as described above, you need to do a manual package restore. Else VS keeps throwing a package version not found error. For some reason VS 2015 was not doing auto package restore when the new line was added to the tools section in the file.
BTW: Thanks for the original solution above.
After upgrading to netcoreapp1.0 I'm not able to run my project. I've resolved all errors and fixes for the update, restored packages and get no errors anywhere.
(I followed this guide for upgrading https://learn.microsoft.com/en-us/dotnet/articles/core/migrating-from-dnx)
All I get is the classic Object reference not set to an instance of an object. which kind of drives me nuts.
Run command
$ dotnet run
Object reference not set to an instance of an object.
My tools:
$ dotnet --info
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.10
OS Platform: Darwin
RID: osx.10.10-x64
(Also ran on my Win 10 box with the same result, unable to run from cmd or visual studio as well)
The --log 4 doesn't output anything either.
Any ideas on how to nail it down?
UPDATE:
project.json
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"System.Diagnostics.Process" : "4.1.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "Avantime.Sniff"
}
}
Not sure what caused the error above but after reading various release notes on github and minor fixes this was the needed adjustments to get it working.
Also with a lot of work removing all references to old libraries depending on older code than netcore50 (mostly updating EF7 to EntityFrameworkCore) in code.
My fixes:
Added Program.cs as new entry point for application
public static class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
Fixed Startup signature according to this: https://github.com/aspnet/Announcements/issues/171
public Startup(IHostingEnvironment env)
{
// Setup configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("config.json");
[...]
Changed package.json to
{
"dependencies": {
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Mvc.Core": "1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.NETCore.Runtime.CoreCLR": "1.0.2", <-- IMPORTANT
"Microsoft.Extensions.PlatformAbstractions": "1.0.0" <-- IMPORTANT
},
"buildOptions": {
"compile": {
"include": [
"../../shared/**/*.cs"
]
},
"copyToOutput": {
"include": [
"Areas",
"Views",
"wwwroot",
"config.json",
"web.config"
]
},
"define": [
"DEMO",
"TESTING"
],
"emitEntryPoint": true, <- IMPORTANT
"preserveCompilationContext": true,
"warningsAsErrors": false
},
"publishOptions": {
"include": [
"Areas",
"Views",
"wwwroot",
"config.json",
"web.config"
]
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"frameworks": {
"netcoreapp1.0": {
"Microsoft.NETCore.App": {
"version": "1.0.0-*",
"type": "platform"
},
"imports": [ "netcore50", "portable-net452+win81" ] <- IMPORTANT
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-*"
},
"scripts": {
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
},
"webroot": "wwwroot",
"version": "1.0.0-*",
"runtimes": {
"win10-x64": {}
}
}