dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.06k forks source link

Microsoft.DotNet.Props was not found #7129

Closed xatabhk closed 4 years ago

xatabhk commented 7 years ago

Steps to reproduce

Build MusicStore sample

Expected behavior

No error

Actual behavior

C:\temp\MusicStore-dev\samples\MusicStore>dotnet build Microsoft (R) Build Engine version 15.1.0.0 Copyright (C) Microsoft Corporation. All rights reserved.

Build started 11/11/2016 10:13:07 AM. 1>Project "C:\temp\MusicStore-dev\samples\MusicStore\MusicStore.xproj" on node 1 (Build target(s)). 1>C:\temp\MusicStore-dev\samples\MusicStore\MusicStore.xproj(7,3): error MSB4019: The imported project "C:\Program Files (x86)\dotnet\sdk\1.0.0-preview4-004071\Extensions\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. 1>Done Building Project "C:\temp\MusicStore-dev\samples\MusicStore\MusicStore.xproj" (Build target(s)) -- FAILED.

Build FAILED.

   "C:\temp\MusicStore-dev\samples\MusicStore\MusicStore.xproj" (Build target) (1) ->
     C:\temp\MusicStore-dev\samples\MusicStore\MusicStore.xproj(7,3): error MSB4019: The imported project "C:\Program Files (x86)\dotnet\sdk\1.0.0-preview4-004071\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.

0 Warning(s)
1 Error(s)## Environment data

dotnet --info output: C:\temp\MusicStore-dev\samples\MusicStore>dotnet --info .NET Command Line Tools (1.0.0-preview4-004071)

Product Information: Version: 1.0.0-preview4-004071 Commit SHA-1 hash: 9855dc0088

Runtime Environment: OS Name: Windows OS Version: 10.0.14393 OS Platform: Windows RID: win10-x86

dotnet_error__msb4019

livarcocc commented 7 years ago

Have you migrated this project to csproj? The msbuild based CLI does not support xproj. If you migrate your projet, we will create an equivalent csproj for it and move your project.json and xproj to a backup folder.

Please, re-activate if that doesn't solve your problem.

xatabhk commented 7 years ago

It still did not work after migrated; "dotnet restore/build" fails. MusicStore or project by "dotnet new -t web" has the same issue too.

livarcocc commented 7 years ago

Not all package dependencies for web projects are available yet, which is why it fails for you.

kierenj commented 7 years ago

I'm getting the same MSB4019 suddenly on an Azure App Service. I was using 1.1 preview just fine. Can I force an older version of the tooling somehow to temporarily work around?

dotnet there suddenly doesn't support project.json files at all - errors from MSBUILD each time, even having deleted .slns and .*projs ?

kierenj commented 7 years ago

I found this - http://stackoverflow.com/questions/40699867/choose-the-sdk-version-e-g-preview3-vs-preview2-that-the-dotnet-cli-uses - after much searching. No idea why Azure team would decide to use preview tools which break stuff by default.

Edit: nope, Azure ignores the global.json setting too. Great!

Another edit: OK, they just have specific, different versions than I have. And global.json doesn't look to have a wildcard/min/max format.

adrobson commented 7 years ago

Hi @kierenj was this ever solved. I am trying to deploy something to Azure and there seems to be an issue with a script on the Azure servers. Actually, disregard that, I added the global.json and deployment to Azure worked.

theShiva commented 7 years ago

Hello, I'm getting this error too, as of March 14th 2017.

The most baffling this is that, I had a Web API Project called CityInfo.API, that was working as of Feb 19th 2017. I didn't change anything, it was sitting in my VM.

Today, when I opened the Project in Visual Studio 2015, I got the following dialog / Message.

image

Then when I tried a build (didn't change a thing) I got the following error (same as in this issue dotnet/cli#4683 )

image

livarcocc commented 7 years ago

@theShiva my guess is that you installed a new CLI (1.0.1) and you are trying to open a project without global.json pinning the version of the CLI to what you need for VS2015 (preview2). So, add a global.json to the root of your repo, with

{
  "sdk": {
    "version": "your_preview2_cli_version"
  }
}

Basically, VS2015 only works with CLI preview2. VS2017 needs at least CLI 1.0.0.

psulek commented 7 years ago

@livarcocc Thanks a million times! This helps me a lot! For me such error(s) starts showing after installing final VS2017 and have also VS2015. So having both VS2015 and VS2017 will starts throwing such errors for VS2015 NET Core projects which uses SDK 1.0.0-preview2-003121.

liuzexiazbx commented 7 years ago

how to resolve this problem?can you give me a detail ways,thanks

liuzexiazbx commented 7 years ago

waiting for answers online

liuzexiazbx commented 7 years ago

@livarcocc

psulek commented 7 years ago

@liuzexiazbx in folder where you have sln file, create global.json file with content described above by @livarcocc , eg:

{
  "sdk": {
    "version": "your_preview2_cli_version"
  }
}
liuzexiazbx commented 7 years ago

thanks you for reply.I have done with above, image.but still wrong

psulek commented 7 years ago

As i am using VS2015 i have other version string: "version": "1.0.0-preview2-003121"

liuzexiazbx commented 7 years ago

but my sdk is 1.0.1. image this problem troubled me all two hours @xatabhk

psulek commented 7 years ago

My is 1.0.0 so i cant help you more. Maybe someone other who is on 1.0.1

livarcocc commented 7 years ago

@liuzexiazbx if you are using VS 2015, you need to use CLI preview2. VS 2015 does not support msbuild based CLI, which is what 1.0.0 and 1.0.1 are.

liuzexiazbx commented 7 years ago

@livarcocc thank you for answer,I have back to use 1.0.0-preview2-003121,but I also not understand what differences between CLI preview2 and CLI.I think I need to learn more. dotnet core 2 maybe will also too problems

rafaelmelo007 commented 7 years ago

I am facing the same error. It seems to be one error in the .NET Core 1.0.1 SDK.

livarcocc commented 7 years ago

@rafaelmelo007 Have you see the thread above? If you are on VS 2015, add a global.json pointing to the preview2 version of the CLI, where project.json and VS2015 are supported.

if you are in VS2017, make sure that your solution was updated to point to the csproj created by migration, instead of the old xproj.

If you are in VS2017 and the SLN was not updated to point to the csproj automatically, please let us know.

ndenkha commented 7 years ago

None of this is working for me. Is there a valid instruction page that someone can share? I just wonder when will Microsoft start producing something other than garbage?

mharasimowiczcontrolexpert commented 7 years ago

Hi, something like that works for me:

global.json file

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-1-003177"
  }
}

My sdk directory: capture

You can download the sdk from this page: https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.1-preview2.1-download.md

liuzexiazbx commented 7 years ago

we were faced problems with.NET Core 1.0.1 SDK.not 1.0.0@mharasimowiczcontrolexpert

ndenkha commented 7 years ago

Thank you mharasimowiczcontrolexpert, this download fixed it.

StefH commented 7 years ago

When using this version https://download.microsoft.com/download/0/A/3/0A372822-205D-4A86-BFA7-084D2CBE9EDF/DotNetCore.1.0.1-SDK.1.0.0.Preview2-003133-x64.exe in AppVeyor I get the same error:

Start-FileDownload 'https://download.microsoft.com/download/0/A/3/0A372822-205D-4A86-BFA7-084D2CBE9EDF/DotNetCore.1.0.1-SDK.1.0.0.Preview2-003133-x64.exe'
Downloading DotNetCore.1.0.1-SDK.1.0.0.Preview2-003133-x64.exe (44,309,024 bytes)...100%
DotNetCore.1.0.1-SDK.1.0.0.Preview2-003133-x64 /quiet
appveyor-retry dotnet restore -v Minimal
C:\projects\queryinterceptor-core\test\QueryInterceptor.Core.ConsoleApp\QueryInterceptor.Core.ConsoleApp.xproj(7,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.1\Microsoft\VisualStudio\v14.0.25123\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
EvAlex commented 7 years ago

Thank you, @mharasimowiczcontrolexpert. It worked and saved my day! I'll be using this recipe to build projects that still have no time to migrate to newer versions

osman-masood commented 7 years ago

I'm using dotnet CLI 1.0.1, with .NET Core 1.0.3 SDK Preview 2 build 3156, and have a global.json file similar to @mharasimowiczcontrolexpert's above, but am getting this error:

~/me/myproject => dotnet restore
/Users/me/myproject/myproject.xproj(7,3): error MSB4019: The imported project "/usr/local/share/dotnet/sdk/1.0.1/
Microsoft/VisualStudio/v14.0.25420/DotNet/Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

This is my global.json:

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-003121"
  }
}

Am I to understand that I cannot get past this error unless I upgrade to .NET Core 1.1.0 SDK Preview 2.1 build 3177?

Thanks.

osman-masood commented 7 years ago

Update -- I actually got it to work. I had to delete all other versions of dotnet from my /usr/local/share/dotnet and its subdirectories (on macOS).

Compiling myproject for .NETCoreApp,Version=v1.0

Compilation succeeded.
    0 Warning(s)
    0 Error(s)

Time elapsed 00:00:01.0217817
kishoretvk commented 7 years ago

For visual studio 2015, with adk 1.03 we still ge this, howeve vs2015 comes with different sdk. and will the global json fix the issue ? can thre be a proper fix ?

any of the dotnet coer sdk's have this folder installed

  1. preview
  2. 1.0.1
  3. 1.0.3 seems this a prvailig issue from last 2 releases of dotnet core.

however i was able to fix it when i added global.json and did dotnet restore. Note: dotnet restore at soltion level folder was not fixing the issue. i when into the folder for project level and had to dotnet restoe. at solution level

it throws another error, saying dotnet props not found , file exists on disk !!

Hope this helps !

Philyorkshire commented 7 years ago

Okay so I just had this issue which stumped me for a few days. I was downloading the latest SDK from Microsoft (1.0.3) and using the global.json as specified here but, I needed to use preview, in my case and not the latest and it worked!

{
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}

Hope it helps someone.