I created a simple ASP.NET Core application and I want to build it on Windows 10 for Windows 10 and CentOS 7. So my I have this in my project.json file:
"runtimes": {
"win10-x64": { },
"centos.7-x64": { },
"win81-x64": { }
},
Without "win81-x64" I got an error:
Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win81-x64, win8-x64, win7-x64'
After dotnet build command i see this:
Project ListService (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing Compiling ListService for .NETCoreApp,Version=v1.0
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:14.3853704
And command dotnet --info shows:
Product Information:
Version: 1.0.0-preview2-003131
Commit SHA-1 hash: 635cf40e58
Runtime Environment:
OS Name: Windows
OS Version: 6.3.9600
OS Platform: Windows
RID: win81-x64
Am I missing something? Also the dotnet publish -r foo-version did not helped.
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"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.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"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"runtimes": {
"win10-x64": { },
"centos.7-x64": { },
"win81-x64": { }
},
"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": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Ok so now it works.
What I did was:
I removed "type":"platform" from project.json file
I ran command dotnet build -r centos.7-x64 in cmd from project folder
And now i see
Related
I am using Visual Studio 2015. And I am develop app with Entity.Core.
But I am getting error while using Add-migration command.
I identified my models.
But getting error using the command "Add-migration TestDb" with Nuget Package Console.
Startup project 'src\WebApplication1' is an ASP.NET Core or .NET Core
project for Visual Studio 2015. This version of the Entity Framework
Core Package Manager Console Tools doesn't support these types of
projects.
How can I solve it.
And I don't want to Visual Studio 2017. Please do not recommend that.
The same operations I can do on my other computer.
I've update my question with project.json.
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0",
"Microsoft.EntityFrameworkCore": "1.1.1",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.1"
},
"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",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Docs for EF Core: https://learn.microsoft.com/en-us/ef/core/
Make sure you read the documentation.
So you are getting that error probably for 2 reasons:
1)In your project.json file make sure you have EntityFrameworkCore.Design/Tools added in you dependencies and EntityFrameworkCore.Tools in your tools.
"dependencies": {
"Microsoft.EntityFrameworkCore": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
}.
"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
2) Once you sorted the above issue this will allow you to use the appropriate commands in your cli (PM Console) make sure you are in the project directory:
Create Migration: dotnet ef migrations add <name>
Update Database: dotnet ef database update
I've got the same error on PM> Update-Database. If you have the latest version of Microsoft.EntityFrameworkCore.Tools (1.1.1 is the latest stable version when I posted this answer) and you are using VS2015, try to downgrade to
Microsoft.EntityFrameworkCore.Tools 1.1.0-preview4-final
Install from package manager : Install-Package Microsoft.EntityFrameworkCore.Tools -Version 1.1.0-preview4-final -Pre
My package.json looks like this :
{
"dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.1.2",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.2",
"Microsoft.AspNetCore.Mvc": "1.1.3",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.2",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.2",
"Microsoft.AspNetCore.StaticFiles": "1.1.2",
"Microsoft.EntityFrameworkCore.Design": "1.1.2",
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.2",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
"Microsoft.Extensions.Logging.Console": "1.1.2",
"Microsoft.NETCore.App": {
"version": "1.1.2",
"type": "platform"
}
},
"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",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Hope it helps anyone.
Just followed the install instructions on https://www.microsoft.com/net/core#linuxubuntu and https://learn.microsoft.com/en-us/aspnet/core/getting-started
Everything is fine so far, except when creating a new user under http://localhost:5000/Account/Register it fails with
SQLite Error 'no such table: AspNetUsers'
Tried with dotnet ef database update to create the table structure but it fails with version errors.
Now I got lost with all the different versions in the project.json, when to use 1.1.0 and when 1.0.0, when should it be preview1-final preview2-final preview3-final or even better preview2-update1
project.json out of the box after dotnet new -t web
{
"userSecretsId": "aspnet-WebApplication-0799fe3e-6eaf-4c5f-b40e-7c6bfd5dfa9a",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0-preview1-001153-00",
"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.Sqlite": "1.0.1",
"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.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-update1",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-update1",
"type": "build"
}
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"Microsoft.Extensions.SecretManager.Tools": {
"version": "1.0.0-preview2-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "WebApplication"
}
}
Asp.net core - no such table: AspNetUsers and seems similar but it is windows.
How to update project.json to get the initial ASP.net core template working with saving to SQlite? Or is anything else missing regarding SQlite on Ubuntu? libsqlite3-0:amd64 in version 3.14.1-1build1 is installed...
I had this same issue while I was developing on a MAC and deploying to Debian. I ended up copying the database file from my development machine to the production server. If you inspect the database file that was produced from the publish command it is empty. Hope this helps you!
With the latest bits (1.0.0-rc4-004777) from github and some help on github (EF Core Tools Bug Bash #7358) I got a solution
wget https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-dev-ubuntu.16.04-x64.latest.tar.gz
sudo mkdir /opt/dotnet
sudo tar zxvf dotnet-dev-ubuntu.16.04-x64.latest.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin
mkdir testweb
cd testweb
dotnet new mvc --auth Individual
dotnet restore
Edit the .csproj and add
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet"
Version="1.0.0-msbuild3-final" />
</ItemGroup>
After saving the .csproj you will be able to create the database and the template will run fine.
dotnet restore
dotnet ef database update
dotnet run
With all the above it is possible now running the template under Linux and create users and log in http://localhost:5000/Account/Register and the EntityFrameworkCore stores to sqlite.
I've just migrated a asp.net core project from 1.0.1 to 1.1.0 and when running dotnet run or dotnet restore I get the following message
C:\Users\you\Desktop\API\src\API\API.xproj(7,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-preview4-004110\Extensions\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
I've installed all the SDK and runtimes, but still can't neither create .Net Core 1.1.0 projects in visual studio nor restore in console my packages.
The project.json is as follows, supposedly the migration is right, but still can't figure it out.
{
"version": "1.0.0-*",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"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.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",
"Business.Handlers": "1.0.0-*",
"Business.Connectors": "1.0.0-*",
"Common": "1.0.0-*",
"DataAccessLayer": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.1": {
"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%" ]
}
}
The problem was in the global.json of my solution the version property, I had it changed to 1.0.0-preview2-1-003177 and it worked.
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-1-003177" //Previously 1.0.0-preview2-003131
}
}
You need to download .NET Core 1.1 SDK - Installer from Microsoft website. If you can download only runtime as well. Below is the url for the same.
https://www.microsoft.com/net/download/core
Please see image below for more details.
.net core 1.1.0
Regards,
Sachin Pawar
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": {}
}
}
Installed the most recent (I think) .NET Core, created a .NET Core web project via Visual Studio 2015, and tried to start using user secrets. The CLI claims it is missing (after claiming to have installed it...), as below:
E:\Projects\CodeServer>dotnet --version
1.0.0-preview1-002702
E:\Projects\CodeServer>dotnet restore
<snip>
log : Restoring packages for tool 'Microsoft.Extensions.SecretManager.Tools' in E:\Projects\CodeServer\src\CodeServer\project.json...
<snip>
log : Restore completed in 2345ms.
NuGet Config files used:
C:\Users\Work User\AppData\Roaming\NuGet\NuGet.Config
C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
E:\Projects\CodeServer>dotnet user-secrets -h
No executable found matching command "dotnet-user-secrets"
E:\Projects\CodeServer>
Also adding the project.json file per request:
{
"userSecretsId": "<snip>",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.AspNetCore.Authentication.Google": "1.0.0-rc2-final"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"Microsoft.Extensions.SecretManager.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
When using any of the tools packages defined in the tools section of your project.json file, you must use them from the same directory that contains the project.json file.
For example, your project.json file is in E:\Projects\CodeServer\src\CodeServer\project.json, but you are trying to execute the command from E:\Projects\CodeServer. If you change to the E:\Projects\CodeServer\src\CodeServer\ directory before attempting to use the tools, the commands will then work.
I have found that the package manager console is sometimes (or all the time for) is unable to use the correct directory (even if it is selected in the default project dropdown). If you first execute the command 'cd src\YourProjectName' and then e.g. 'dotnet user-secrets -h' (for help) you should be able to use the user-secrets tool.
The accepted answer to this question is correct but the project.JSON file doesn't exist anymore. (Visual Studios 2017 and .Net Core 2.1) It has been replaced by a "your-app-name".csproj file. Reference: there is no project.json, global.json ... etc on .NET Core Solution with Visual Studio 2017