sdk: Error on "dotnet restore restore.dg" for ASP.Net Core Project in VS 2015 Update 3 with latest Dotnet CLI.

Hi,

Steps to Reproduce

Create a new ASP.Net Core application in Visual Studio Community 2015 Update 3 on Windows 10 with latest Dotnet CLI (preview3-003686) and VS Tooling (VS2015Tools.Preview2.0.2). Point nuget.config to aspnetcore-dev myget feed.

Actual behavior

When ever I create a new ASP.Net Core Project in Visual Studio community 2015 update 3, the first package restore (which happens immediately after project creation) fails with following error. In fact the same error is coming even if we do restore packages (by right clicking references of the project).

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
C:\Program Files\dotnet\dotnet.exe restore "C:\Users\ramiadmin\Desktop\SampleApp\.vs\restore.dg"
error: Error reading 'C:\Users\ramiadmin\Desktop\SampleApp\.vs\restore.dg' at line 0 column 0 : Unexpected character encountered while parsing value: #. Path '', line 0, position 0.
error:   Unexpected character encountered while parsing value: #. Path '', line 0, position 0. 

Interesting point it, if I dot dotnet restore from command line, it successfully restore all the packages. Also dotnet run from command line works absolutely fine.

I pointed my nuget.config to aspnetcore-dev myget feed -

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://dotnet.myget.org/F/aspnetcore-dev/api/v2/" />
  </packageSources>
  <disabledPackageSources>
    <add key="Microsoft and .NET" value="true" />
  </disabledPackageSources>
</configuration>

Following is my global.json -

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview3-003686"
  }
}

Following is my project.json -

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0-*",
    "Microsoft.AspNetCore.Mvc": "1.1.0-*",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-*",
      "type": "build"
    },
    "Microsoft.AspNetCore.Routing": "1.1.0-*",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0-*",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0-*",
    "Microsoft.Extensions.Configuration.Json": "1.1.0-*",
    "Microsoft.Extensions.Logging": "1.1.0-*",
    "Microsoft.Extensions.Logging.Console": "1.1.0-*",
    "Microsoft.Extensions.Logging.Debug": "1.1.0-*",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0-*",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0-*"
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-*",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Expected behavior

Either after the initial application creation or by selecting restore packages (by right clicking references in VS), Packages should be restored successfully with out errors.

Environment data

.NET Command Line Tools (1.0.0-preview3-003686)

Product Information: Version: 1.0.0-preview3-003686 Commit SHA-1 hash: 038fb6fbae

Runtime Environment: OS Name: Windows OS Version: 10.0.10586 OS Platform: Windows RID: win10-x64

I used Visual Studio Community 2015 Version 14.0.25425.01 Update 3.

I have installed Visual Studio 2015 Tooling Preview 2 of version DotNetCore.1.0.1 - VS2015Tools.Preview2.0.2 from https://go.microsoft.com/fwlink/?LinkId=827546

OS - Windows 10 Enterprise N

About this issue

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

Most upvoted comments

Same thing here 😕 Happens during restoring nuget packages. This operation fails and #: is being added at the beginning some lines (mostly first line) in the restore.dg file on every package restore try.

It results in ‘Package restore failed’ error in Output: [file path] at line 0 column 0 : Unexpected character encountered while parsing value: #. Path '', line 0, position 0. error: Unexpected character encountered while parsing value: #. Path '', line 0, position 0.

Thus, some of the references, have yellow warning sign instead of icons, but solution builds successfully anyway.

@EncoderPtd My application was brand new, created with VS. I never changed a single file in it. Except I updated global.json with new sdk version and project.json with new versions (I am sure that these versions are available in MyGet). So I think my problem is completely different. Waiting for someone from Core team to reply.

In the mean time, I will make my project available in github and link it here.

Command line works. In VS failed.