4
votes

I am trying to build a new front end application with dotnet core but getting an error as below while to open the project.

i followed that answer but not working for me.

here is the error i am getting

dotnet --info

project

getting this error while trying to restore :

error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.

running dotnet restore command gives below error :

error MSB4019: 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.

2
Have you followed github.com/dotnet/cli/blob/rel/1.0.0/Documentation/… and updated your global.json to include a specific SDK version? - Ignas
you mean adding a global.json file to solution - Ravi Mittal
Normally you should have global.json in your solution when you create a new project. Can you post a screenshot of your solution files tree? - Ignas
just added global.json file it was not there - Ravi Mittal
@Ignas I am able to resolve the issue. Actually preview 2 SDK was not installed properly. - Ravi Mittal

2 Answers

3
votes

I got the same problem yesterday. Unfortunately, I don't know exactly what I was doing wrong, but I managed to solve my error.

I used the strategy on this page here

I added a global.json file in my Solution Items and I specified all the .xproj projects of my solution.

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

Hope it helps.

0
votes

Running dotnet-restore solved this issue for me. This was after i had updated the global.js to tarket the specific SDK version.

https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-restore