Home: VS Nuget does not work anymore on WebSite projects

Created on 8 Dec 2017  路  8Comments  路  Source: NuGet/Home

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe):
VS UI

NuGet version (x.x.x.xxx):
4.5.0

VS version (if appropriate):
15.5

OS version (i.e. win10 v1607 (14393.321)):
Win7

Worked before? If so, with which NuGet version:
Yes, the problem now occurs after a clean install of VS. I have a fresh install now. With my older/bloated install it worked.

Description:
Nuget in VS totally does not understand my WebSite project anymore (so not Web Application, but Web Site). When I do Manage Nuget Packages:

image

In my root I have packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.5.0.2" targetFramework="net461" />
  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" />
  <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.8" targetFramework="net461" />
  <package id="Microsoft.Net.Compilers" version="2.4.0" targetFramework="net461" developmentDependency="true" />
  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
  <package id="RestSharp" version="105.2.3" targetFramework="net461" />
  <package id="Serilog" version="2.5.0" targetFramework="net461" />
  <package id="Serilog.Formatting.Compact" version="1.0.0" targetFramework="net461" />
  <package id="Serilog.Settings.AppSettings" version="2.1.2" targetFramework="net461" />
  <package id="Serilog.Sinks.File" version="4.0.0" targetFramework="net461" />
  <package id="Serilog.Sinks.PeriodicBatching" version="2.1.1" targetFramework="net461" />
  <package id="Serilog.Sinks.Seq" version="3.4.0" targetFramework="net461" />
  <package id="SerilogWeb.Classic" version="3.0.20" targetFramework="net461" />
  <package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
  <package id="WebGrease" version="1.6.0" targetFramework="net461" />
</packages>

When I try to install a package:

image

Note:
Notice that I use a WebSite here, the nuget mechnism for these projects are quite weird because WebSites don't have .csproj files. It works with .refresh files and a packages.config. In fact, packages.config doesn't really do much. To my understanding, it is Msbuild that will resolve all the .refresh files before build (probably a special MSBuild target voor WebSite projects).

Please help me debug my issue.

NotRepro

All 8 comments

Does it work if you create a new WebSite project?

I just tried with a new website project, it worked fine for me along with installing a new package as well.

Can you also check that at your end?

We're getting this same issue. Running nuget restore name.sln produces a warning for each website:
WARNING: Project file D:\path\to\solution\directory\http://localhost/folder/site cannot be found.

Edit: A new solution and project work properly. Looks like it has something to do with having a URL as the project name. Changing the solution file directly solved it for us.

@chris-cartwright what version of NuGet/VS are you using?

Visual Studio is version 15.5.1. NuGet on the command line is 4.3.0.4406.

We don't know when it actually broke. The packages don't get restored or updated very often in that particular solution.

What we had to change:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Project.Name", "http://localhost/Project/Name", "{2BF15845-628E-47EF-92AE-837FF5BCA24C}"
to:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Project.Name", "Project.Name\", "{2BF15845-628E-47EF-92AE-837FF5BCA24C}"

NuGet 4.5.0 is the equivalent for VS 15.5, try using that and let me know if it fixes the issue.
https://dist.nuget.org/win-x86-commandline/v4.5.0/nuget.exe

4.3.0 at this point is old, and I think there were bugs fixed since then for web sites.

"4.3.0 at this point is old"

Didn't 4.0 come out in like March of this year?

Closing since this should be fixed in 4.5.0. Please let me know if this isn't fixed there and we can reopen this.

Was this page helpful?
0 / 5 - 0 ratings