1

So the short version here is that my old existing repo's that utilize a global.json and project.json (all Nancy projects) work perfectly fine with no issue.

However, if I attempt to create a new folder structure with the identical global.json, project.json, and file structure, I get the error below when attempting anything with the cli:

C:\VSCode\DispoStatService> dotnet restore A JSON parsing exception occurred in [C:\VSCode\DispoStatService\global.json]: * Line 1, Column 2 Syntax error: Malformed token MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file

See screenshot as well for more detail: DotNetCLI Examples

  • It seems you have a syntax problem in your json files. From what I can see with your screen shot, you should rename the `src/global.json` to `src/project.json`. – Eastrall Mar 15 '17 at 11:20
  • I have both. The fact I'm using `project.json` implicitly means I need to tell the cli the correct sdk – Fernando Rodriguez Mar 15 '17 at 11:53
  • 2
    try hexdumping the files to check whether they really are binary-identical. it's not out of the question that there could be some sort of invisible character – banana Mar 15 '17 at 11:59

2 Answers2

0

As it turns out, I did not really find the ultimate problem or solution for what was happening here. As we so often do, though, I got it to work.

I'm assuming perhaps just starting with a different set of files (since the error was consistently telling me there was a bad character in global.json) did the trick.

tl;dr - I basically just copied a separate NancyFX project template I already had

  • It did use a different sdk/cli version but I don't think that was the real culprit here
  • I then renamed all my namespaces to match the new project

Ultimately, my project.json

{
  "name": "DispoStatsService",
  "version": "1.0.0-beta",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {
    "Microsoft.AspNetCore.Owin": "1.1.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.Extensions.Configuration.Binder": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Nancy": "2.0.0-clinteastwood",
    "Dapper": "1.50.2"
  },
 "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ],
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.1.0"
        }
      }
    }
  },
  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": {
      "version":"1.1.0-preview4-final",
      "imports": "portable-net45+win8+dnxcore50"
    }
  },
  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config",
      "appsettings.json",
      "Content"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

and my global.json

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

See directory structure here: enter image description here

0

I had the same problem until I removed the BOM from the *.json files

rugg
  • 531
  • 3
  • 9