question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
ignacy130commented, Oct 4, 2016

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.

1reaction
DreamingDevscommented, Sep 28, 2016

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error on "dotnet restore restore.dg" for ASP.Net Core ...
Hi, Steps to Reproduce Create a new ASP.Net Core application in Visual Studio Community 2015 Update 3 on Windows 10 with latest Dotnet...
Read more >
dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >
Package Restore Failed / .Net Core Install Bug
I have the same issue in previous version of Visual Studio 2015 but it works fine in both of my Visual Studio Community...
Read more >
Error MSB4025: The Project File Could Not Be Loaded
You've just installed Visual Studio 2017 (Or the very latest .net core SDK), ... .vs\restore.dg(1,1): error MSB4025: The project file could not be...
Read more >
After VS 17.8 update, Yellow triangle on all nuget ...
NET CORE 2.1 2) Update VS 17.8 3) Nuget dependences all in YELLOW without warning. 4) Nuget packet says no installed packages. 5)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found