When I want to add Entity Framework migration to my ASP.NET Core 1.1 by run "dotnet ef migrations add InitialCreate" get this error
"No executable found matching command "dotnet-ef"".
After google this error i wanted to add Microsoft.EntityFrameworkCore.Tools.DotNet Package to project but in console get this:
"Install-Package : Package 'Microsoft.EntityFrameworkCore.Tools.DotNet
1.0.1' has a package type 'DotnetCliTool' that is not supported by project"
and this is project.json:
{ "tools": { "Microsoft.EntityFrameworkCore.Tools": "1.1.1" } }
What should I do exactly to enable migration in my project?
The project.json tooling never RTMed. You should upgrade to Visual Studio 2017 (and the .NET Core SDK 1.0.4).
If you really want to continue using project.json, it should look like this (But realize it's unsupported)
{
"dependencies": {
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.1",
"Microsoft.EntityFrameworkCore.Design": {
"version": "1.1.1",
"type": "build"
}
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview4-final"
}
}
Changing the version to 2.0.2 for "Microsoft.EntityFrameworkCore.Tools" should work
I am trying to migrate an Asp.Net Core RC1 project to RC2 and have been following this documentation and have also followed the instructions for DNX migration to .NET CLI.
I am getting the following error when I try dotnet run:
Can not find runtime target for framework '.NETCoreAPP, Version=v1.0'
compatible with one of the target runtimes: 'win10-x64, win81-x64,
win8-x64, win7-x64'. Possible causes:
The project has not been restored or restore failed -run 'dotnet restore'
The project does not list one of 'win10-x64, win81-x64, win7-x64' in the 'runtimes'
I have run dotnet restore and it seems to have completed successfully.
I have updated all the relevant packages to RC2.
I should have done exactly what the error message said. When migrating from RC1, I did not realise that I had to specify a runtimes section in my project.json file.
In my project.json I added the following section:
"runtimes": {
"win10-x64": { }
}
And I was good to go.
Update 27 February 2017
New project templates in Visual Studio 2017 RC no longer require run times to be specified (in project.json or .csproj) in advance if you choose to deploy your app as a Framework Dependent Deployment (FDD).
If, however, you choose to deploy your app using Self-contained Deployment (SCD), then you will need to specify all the run times you want your app to run on in advance in your .csproj file.
Below is an example of a .csproj file for an app that uses the SCD deployment method:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.0</TargetFramework>
<VersionPrefix>1.0.0</VersionPrefix>
<DebugType>Portable</DebugType>
<RuntimeIdentifiers>win10-x64;osx.10.11-x64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
</Project>
Please see this link for more information, which includes a thorough description of both types of deployment options, as well as their benefits and disadvantages.
I received this error after updating VS2015 core template to 1.0.1. It was because I have a PCL that targets netstandard 1.4 if you don't want to have to specify each runtime, Just change the dependency markup for Microsoft.NETCore.App to this:
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
in project.json I changed this (added type):
//"Microsoft.NETCore.App": "1.1.0",
"Microsoft.NETCore.App": { "version": "1.1.0", "type": "platform" },
Now I can build again :-)
update: now I can build again but not "run" the website.
You need to make sure you have the runtime and sdk also:
*) Visual Studio tools include .NET Core 1.0.1. To add .NET Core 1.1 support you need to also install the .NET Core 1.1 runtime.
https://www.microsoft.com/net/download/core#/current
I received this error because I used the incredibly broken NuGet Package Manager in Visual Studio 2015 to update my project.json dependencies. It turned this:
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
}
}
}
into this:
"dependencies": {
"Microsoft.NETCore.App": "1.1.0"
},
"frameworks": {
"netcoreapp1.0": {}
}
Bye bye, platform definition!
If you read these two links:
First, https://learn.microsoft.com/en-us/dotnet/articles/core/tutorials/using-with-xplat-cli
and
second, https://learn.microsoft.com/en-us/dotnet/articles/core/rid-catalog
You will see that you can build a completely portable version using the following snippet in the dependencies root element in project.json. There is no need to specify runtimes as this is a CORE level runtime which should be platform agnostic, or known as "Framework dependent"
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
or you can build for multiple targeted platforms ("self contained applications") by removing the type: platform element like this:
Add this to the dependencies root element in project.json
"Microsoft.NETCore.App": {
"version": "1.0.1"
}
and add this as a new root level element
"runtimes": {
"win10-x64": {}, /* one or more RIDs */
"osx.10.10-x64": {}
},
Multiple targeted requires that you supply platform names known as ".NET Core Runtime IDentifiers (RID)" A list of these can be found at the second link above. It includes many flavors of Windows, Linux and OS X.
For a good overview of the various deployment optins, you can read this page as well:
https://learn.microsoft.com/en-us/dotnet/articles/core/deploying/index
From the above link:
You can create two types of deployments for .NET Core applications:
Framework-dependent deployment
As the name implies, framework-dependent deployment (FDD) relies on a shared system-wide version of .NET Core to be present on the target system. Because .NET Core is already present, your app is also portable between installations of .NET Core. Your app contains only its own code and any third-party dependencies that are outside of the .NET Core libraries. FDDs contain .dll files that can be launched by using the dotnet utility from the command line. For example, dotnet app.dll runs an application named app.
Self-contained deployment
Unlike FDD, a self-contained deployment (SCD) does not rely on any shared components to be present on the target system. All components, including both .NET Core libraries and the .NET Core runtime, are included with the application and are isolated from other .NET Core applications. SCDs include an executable (such as app.exe on Windows platforms for an application named app), which is a renamed version of the platform-specific .NET Core host, and a .dll file (such as app.dll), which is the actual application.
In my case I had just updated all the nuget packages to their latest versions and nuget changed my 'Microsoft.NETCore.App' package reference to the following:
"Microsoft.NETCore.App": "1.1.0"
I changed it back to the following form and everything worked fine:
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
}
Good bye 3 hours of my life....
if you execute a dotnet new and look at the output project json, you will see that the monikers have changed.
Make the changes to your project.json as follows:
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
}
I found one useful link from comment by svick under following page:
https://github.com/dotnet/cli/issues/2442
I found you need the following in project.json. Here is what was required to fix my error:
Dependencies
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
}
Frameworks
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
Runtime
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
You might want to add runtimes if you plan on publishing to IIS. Please see something as follows:
"runtimes": {
"win10-x64": {}
},
Here is a general tip that has worked well for me. When my stuff breaks, I sometimes create a default ASP.NET Core application either the website or empty web api to look at the dependencies in project.json and elsewhere. You can often catch a lot of things that way. The answers above are spot on, but I thought I would write this here in case someone wanted to separate the logic out more in the general template format that ASP.NET Core uses.
In Windows 7 with VS 2015, the soluiton after updating to netcore 1.1.2 was changing the project.json file as following:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": "1.1.2"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50" //This line must disappear
}
},
"runtimes": { //
"win7-x64": {} //Add this lines
} //
}
After changing this the dependencies will update and viola.
I am a new developer working with ASP.NET 5 (ASP.NET Core). In VS2015 I created a new class library project targeting .NET Platform 5.4 (dotnet5.4), and added the AutoMapper NuGet package, version 4.2.0.
I am getting the following errors, basically for all the System packages:
3>C:\Users\Andrew\OneDrive\Development\Visual Studio\APT\src\Fideles.Service\project.json : .NET Platform 5.4 error NU1001: The dependency fx/Microsoft.CSharp could not be resolved.
3>C:\Users\Andrew\OneDrive\Development\Visual Studio\APT\src\Fideles.Service\project.json : .NET Platform 5.4 error NU1001: The dependency fx/System.Collections could not be resolved.
3>C:\Users\Andrew\OneDrive\Development\Visual Studio\APT\src\Fideles.Service\project.json : .NET Platform 5.4 error NU1001: The dependency fx/System.Collections.Concurrent could not be resolved.
But I think according to the NuGet package description it should be supported:
https://www.nuget.org/packages/AutoMapper/
As you can see from the screenshot these packages seem to be referenced twice; once correctly and once incorrectly with an fx/ prefix:
This is my project.json:
{
"version": "1.0.0-*",
"description": "Fideles.Services Class Library",
"authors": [ "Andrew" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"frameworks": {
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-*",
"System.Collections": "4.0.11-beta-*",
"System.Linq": "4.0.1-beta-*",
"System.Runtime": "4.0.21-beta-*",
"System.Threading": "4.0.11-beta-*"
}
}
},
"dependencies": {
"AutoMapper": "4.2.0",
"Fideles.Common": "1.0.0-*",
"Fideles.Data": "1.0.0-*"
}
}
Any ideas? Thank you!
The issue is that dotnet5.4 isn't supported by AutoMapper 4.2.0. Depending on what you're targeting it may be possible to change dotnet5.4 to something else (dnxcore50 for example).
I have the same issue on a number of my own libraries and I'm waiting for netstandard to take care of all this.
If you don't mind interrupting your Visual Studio workflow you can get your application to build by doing the following.
Make sure you have the new dotnet CLI installed
(https://dotnet.github.io/getting-started/)
Run dotnet restore from the command line in your project folder
This sorted out the the build errors. I then deleted my lock files and ran Clean and Rebuild on the solution for good measure.
I have started ASP .NET vNext and I was going through several articles about using bower in Visual Studio 2015 for managing client side libraries, it's pretty simple to use but I am having problems in updating the packages...
I am following this
bower.json:
"dependencies": {
"bootstrap": "3.3.2",
"jquery": "1.4.1",
"jquery-validation": "1.11.1",
"jquery-validation-unobtrusive": "3.2.2",
"hammer.js": "2.0.4",
"bootstrap-touch-carousel": "0.8.0",
"jquery-migrate-official": "^1.2.1",
"bootstrap-hover-dropdown": "2.1.3",
"jquery-slimscroll": "1.3.3",
"jquery-cookie": "1.4.1",
"jquery.uniform": "4.3.0",
"blockui": "2.1.2",
"font-awesome": "4.3.0"
},
The intellisense says that the package blockui has the latest stable version 2.1.2 but package manager log says:
bower blockui#2.1.2 ENORESTARGET No tag found that was able to satisfy 2.1.2
bower blockui#2.1.2 not-cached git://github.com/malsup/blockui.git#2.1.2
bower blockui#2.1.2 resolve git://github.com/malsup/blockui.git#2.1.
Questions:
What does this mean? Is the intellisense picking up the wrong latest version?
Is there any better way to update all client side packages like I used to do using nuget package manager ?
update-package
I read that for server-side packages ASP .NET vNext will use nuget packages but when I write any command in my Package Manager Console nothing happens
update-package
install-package entityframework
You can right-click the 'Bower' node under the 'Dependencies' node and choose 'Restore Packages'. I often have to open the 'Task Runner Explorer' from 'View -> Other Windows' and run the 'bower' task from its context menu. This will trigger a bower installation.
gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
bower: {
install: {
options: {
targetDir: "wwwroot/lib",
layout: "byComponent",
cleanTargetDir: false
}
}
}
});
// This command registers the default task which will install bower packages into wwwroot/lib
grunt.registerTask("default", ["bower:install"]);
// The following line loads the grunt plugins.
// This line needs to be at the end of this this file.
grunt.loadNpmTasks("grunt-bower-task");
};
package.json
{
"version": "0.0.0",
"name": "",
"devDependencies": {
"grunt": "0.4.5",
"grunt-bower-task": "0.4.0"
}
}
The packages should then show up in your wwwroot -> lib directory.
Check out bower's website for more details: http://bower.io/
I just found that for (and for font-awesome package) IntelliSense advices non-existing version. That was 2.1.2, exactly like for your case, that is why I found your question.
I had re-checked real version, corrected it to existing one, and everything started to work.
I'm trying to include the ui-mask utility in my projects bower.json file so other devs will be able to install it when running bower install.
I can install it manually with bower install angular-ui-utils#bower-mask,
but in my bower.json file I can't figure out the correct name/version. Should be mask-0.1.1
Angular UI-Utils
UI-Util Mask Module
What I want to work in bower.json:
{
"name": "project-name",
"dependencies": {
"jquery": "^2.1.x",
"angular": "~1.3.x",
"angular-route": "~1.3.x",
"angular-touch": "~1.3.x",
"angular-sanitize": "~1.3.x",
"at-table": "1.0.1",
"ngDialog": "0.2.13",
"angular-local-storage" : "0.0.7",
"angular-ui-utils#bower-mask" : "0.1.1" <- This should work
}
}
When using bower install angular-ui-utils#bower-mask you instruct bower to look for angular-ui-utils with a "bower-mask" version.
A version in this case is actually a git tag, branch or commit hash (when bower is using a git resolver).
Since the the angular-ui/ui-utils repository has a bower-mask branch it will be resolved.
If you would like to resolve bower-mask 0.1.1 you will need to find the correct tag in the Github repository. In this case this should be mask-0.1.1, so what you need in bower.json is:
{
"name": "project-name",
"dependencies": {
"angular-ui-utils" : "mask-0.1.1"
}
}
In the bower output you should see:
bower resolve git://github.com/angular-ui/ui-utils.git#mask-0.1.1
bower download https://github.com/angular-ui/ui-utils/archive/mask-0.1.1.tar.gz