vscode-csharp: The project file could not be loaded

Moved from Microsoft/vscode#17028

From @Chrille2k


  • VSCode Version: Code 1.7.2 (7ba55c5860b152d999dda59393ca3ebeb1b5c85f, 2016-11-21T22:06:37.428Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions: csharp
Extension Author Version
csharp ms-vscode 1.5.3

Steps to Reproduce:

  1. Open C# project with following project.json
{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {},
  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.0"
        }
      },
      "imports": "dnxcore50"
    }
  }
}
  1. Start debugging and this error is presented:
     1>Project "c:\path\to\project\project.json" on node 1 (Build target(s)).
     1>MSBUILD : error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1. 

What could possibly be wrong on row 1, position 1? File encoding issue?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Hi, I suspect that you allowed Visual Studio Code to generate a launch.json and tasks.json using the “MSBuild” template, which will not work with a .NET Core project.json project. Could you try the following for me?

  1. Update to the latest C# extension in Visual Studio Code (1.6.1).
  2. Open your project and delete the “tasks.json” and “launch.json” files that were generated for you in the “.vscode” folder.
  3. Close and re-open your project.
  4. Eventually, a recommendation should appear to generate assets for building and debugging. Go and and click “Yes” to generate these.
  5. Start debugging.

In that case, you should be able to use dotnet migrate to migrate your application from project.json to .csproj.