Microsoft.DotNet.Props not found - asp.net-core

I'm installing .Net Core 1.0.1 and the lastest preview tooling for Visualt Studio 2015 Update 3.
I've created a project with .Net Core Web API. When I start the solution, it threw me an error box:
I created global.json for solution like this:
{
"projects": [ "Administration" ],
"sdk": {
"version": "1.0.1"
}
}
After that, I used command:
dotnet restore
I received one another error message:
The imported project "C:\Program Files\dotnet\sdk\1.0.1\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
I got in the folder mentioned by the error message, but that path doesn't exist.
I wonder what is going on with my Visual Studio 2015 Community Update 3. Currently, I'm doing my company project, I cannot update my Visual Studio to 2017.
Can anyone help me please. I've spent my whole day searching for solutions but no luck.
Thank you,

The SDK versions and .Net Core versions are not the same. .net core SDK 1.0.1 is not .net core 1.0.1. The last SDK version that works with VS 2015 is Preview 2.
I resolved this error by uninstalling the SDK I had installed (in my case 1.0.4) and installing the latest SDK that works with VS 2015 which is 1.0.0-preview2-003131. You can find the Visual Studio 2015 tools on their downloads page.
A global.json that works for VS 2015 looks like this:
{
"projects": [],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}

Related

VS2017 : Target framework drop down does not show .NET Core 2.1 option

I have already installed VS2017 Enterprise 15.6.4. Recently installed .NET Core 2.1.101 SDK from official site
I was expecting .NET Core 2.1 as one of the target framework available if I create console or asp.net core application. Can someone help me understanding what I am missing here.
As suggested in comments, I installed 15.7 preview 2. Still no luck and same issue.
I have faced the same problem. I solved this by installing the right SDKs with Runtime for .NET Core 2.1.
Basically to run/create 2.1 projects from VS Preview, you need to install the "2.1.300" (not 2.1.4) .NET Core SDKs and Runtime. https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-preview1 (this includes required Runtime already)
The good explanation of this misleading with versions i found here https://github.com/dotnet/cli/issues/8309 (dasMulli commented on Feb 24).
In case this helps someone else... After installing VS 15.9.2 my project that was working fine with 2.2 preview-3 stopped working. VS could not see the preview SDK. I could build the solution using dotnet.exe but not VS.
To solve this I created a global.json at the root folder of this solution pointing to the preview sdk. That allowed VS to see the preview version.
This is a change of behavior in VS between 15.8.x and 15.9.x.
To create the global.json you can navigate to the desired folder and type this:
dotnet new globaljson
Make sure dotnet PATH variables are in correct order
If you have installed an SDK for a different system architecture (e.g., if you installed 32-bit/x86 SDK on a 64-bit computer), then a new entry in the PATH variable would have been created for that specific location (e.g., C:\Program Files\dotnet or C:\Program Files (x86)\dotnet).
The problem is that Visual Studio, when searching for installed frameworks, will stop at the first PATH variable entry it finds that contains an SDK. So, if the first version you installed used an incorrect architecture, then you'll have to adjust the position of those entries before any of the correct SDKs will appear in the Target Framework drop down.
Source: this absurdly-hard-to-find comment within issue #8309.
TL;DR: Make sure the first "C:\Program Files\dotnet\" entry in your path variable you see in the list matches your system architecture:
64-bit = C:\Program Files\dotnet\
32-bit = C:\Program Files (x86)\dotnet\
Make sure that Visual Studio 2017 is up to date. Go to "Tools" -> "Extensions and Updates" to install visual studio updates. This resolved the issue for me.
I have faced the similar situation I tried to install the preview version of the dot net but it did not help.
However after I updated visual studio (from 15.8 to 15.9.6 ).
I Could see dot net core 2.1 in the target framework.
Updated to Latest VS 2017 and installed latest .Net Core SDK.
Changed global.json to point to latest version installed.
This resolved for me.
I had faced the similar issue. I then just updated my Visual Studio 2017 to 15.9.16 version and restarted the system. The problem got resolved.
I was facing the similar issue, I uninstalled the .Net Core 2.2 runtime and then from the below link:
https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral
Install the .Net Core 2.2 Visual Studio SDK, Restarted the Visual Studio and my issue got resolved, .Net Core 2.2 is now getting listed in Target Framework list in the project properties in Visual Studio 2017 Version 15.9.16
I created a new project under .net core 2.1 and it was ok but in my old project have not appeared. So I opened both ".cproject" files and compared them together and found the problem.
Open your project's ".cproject" file in a text editor then replace below line
<TargetFramework>netstandard2.1</TargetFramework>
with this one:
<TargetFramework>netcoreapp2.1</TargetFramework>

".NET Core SDK version 1.0.0-preview2-003131" missing error

I am using Visual Studio 2015 Update 3.
After installing ".NET Core 1.1.0 - SDK 1.0.0 Preview 2.1-003177",
Whenever I am going to create new "asp.net core" web application, I am getting below error, looks like it always refer some old configuration.
How to resolve this, please suggest!
Edit the SDK version in your global.json in Solution Items. Change it to 1.0.0-preview2.1-003177.

Updating a new asp.net core project to core 1.1 packages breaks the project

I just did a File new project in Visual Studio 2015 Community edition with update 3 and created a new Asp.NEt Core Mvc project.
I could build and start the project just fine.
Then I updated all nuget-packagges because many *.core.1.1 packages are available. After I did this, the project can no longer start when I do a simple f5. The browser opens and says the site cant be reached - probably because i fails to start. I tried setting a breakpoint in the main method in the Program.cs file, and that is not even hit. So it looks as if upgrading nuget packages breaks a standard ASP.Net Core project created from the official project template. The project is by deault set to use IIS Express.
Has anybody else experienced the same issue and found a solution ?
Did you follow the guide here: Announcing .NET Core 1.1?
Beside just updating your packages other changes are required, like update of frameworks section in project.json file:
{
...
"frameworks": {
"netcoreapp1.1": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
}
},
"imports": "dnxcore50"
}
}
...
}

The dotnet cli shows 1.0 even though I have installed .Net Core 1.1

I have downloaded and installed the latest .Net Core from https://www.microsoft.com/net/download/core, but after the installation I opened up a cmd prompt and > dotnet --version still shows 1.0.0-preview2-003131
Could someone explain what I'm missing here please?
Update for new comers - 2018-08-01
The original answer was highly targeted at the understanding that the OP had with context at the time (2016). Core has come a long way in the last few years so if you are coming at this now, you might not even know what a global.json and SDK pinning is because it is no longer part of the default template when creating a new project.
Essentially, the CLI will use the highest installed version of .Net Core by default. However, should you choose to, you can dictate a specific version of .Net Core to be used by all apps in nested folders by creating a global.json and setting a specific SDK version. If you do this, you'll get errors when the incorrect version is installed.
The Core team is pretty good about not causing any breaking changes and as described above have opted to remove pinning by default. This actually recently caused some issues for some people because they had not pinned to the version they had built their app against. I personally prefer to pin to the version I'm building against and update it explicitly.
To add extra confusion, the SDK versions don't line up with the version numbers of the .Net Core releases so you really have to "just know" which version to use for what.
For anyone coming to this answer now, the problem that the OP had here was that he didn't realize the global.json was pinning his version nor why the version was so different than the .Net Core version.
Original answer:
The command line is context specific. My guess is you are running from a project that has a global.json in a parent folder that references an older version.
Old Global.json
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}
Change your global.json to:
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-1-003177"
}
}
This change will make the dotnet cli respect the new version in your projects so you can choose when to upgrade your projects. This is how you can have multiple versions of dotnet on your machine and not have to update every one of your projects at once.
[Edit - SDK version confusion]
Just to note, the SDK version you have installed is indeed the 1.1 version of the SDK. The installer indicates the new version of the SDK for 1.1. I've captured a screenshot below.

Enabling C# 6 in ASP.VNext projects in Visual Studio CTP2

I have installed Visual Studio CTP2 and created a new ASP.Net Vext project. When I tried using C# 6.0 features, it was not working. I even tried the stpes in the following link.
No C# 6.0 in Visual Studio 2015 CTP?
But even after this I was not able to use C# 6 in VNext projects. Please help.
Add this to your project.json:
"compilationOptions": {
"languageVersion": "experimental"
}
You should not add the net451 object. Use this inside the project.json file:
{
"compilationOptions": { "languageVersion": "experimental"},
"dependencies": {
},
"commands": {
}
}
I believe they also changed the default in the latest version of the engine. so the element is actually not needed anymore if you upgrade tje kvm to the lastest version.
see https://github.com/aspnet/KRuntime/pull/512
Upgrading can be done by running kvm upgrade at the command prompt.
see https://github.com/aspnet/Home/wiki/version-manager
HTH,
Bart