Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dupe: casing problems of ProjectReference can cause nuget.exe restore to fail. Fixed in 4.4. #5870

Closed
jairbubbles opened this issue Sep 11, 2017 · 12 comments
Labels
Functionality:Restore Product:NuGet.exe NuGet.exe Resolution:Duplicate This issue appears to be a Duplicate of another issue
Milestone

Comments

@jairbubbles
Copy link

jairbubbles commented Sep 11, 2017

Details about Problem

I'm using nuget.exe version 4.3 with Visual Studio Version 15.3.3 on Win10 64bit v1607

Detailed repro steps so we can see the same problem

  1. Unzip this file: NuGetRestoreBug.zip. (It contains nuget.exe v4.3)

  2. Run restore_VS2017.bat which calls nuget.exe restoreon a VS2017 solution

  3. Open source\anvil\AnvilControls\obj\project.assets.json and observe it contains no resolved references whereas the corresponding project Anvil.Controls.vs2017.csproj contains:

  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="8.0.3" />
    <PackageReference Include="System.Reactive.Core" Version="3.1.1" />
    <PackageReference Include="System.Reactive.Interfaces" Version="3.1.1" />
    <PackageReference Include="System.Reactive.Linq" Version="3.1.1" />
  </ItemGroup>

Other suggested things

By running restore_VS2015.bat you can notice that it works correctly with the same projects structure using project.json. (see source\anvil\AnvilControls\project.lock.json)

If you restore directly on the vs2017 project Anvil.Controls.vs2017.csproj it works correctly.

In project Anvil.System.vs2017.csproj there is as Service Reference, when removed it seems to fix the problem.

@zhili1208
Copy link
Contributor

I tried restore_VS2017_bat, but didn't repro it.

 "Newtonsoft.Json/8.0.3": {
        "type": "package",
        "compile": {
          "lib/net45/Newtonsoft.Json.dll": {}
        },
        "runtime": {
          "lib/net45/Newtonsoft.Json.dll": {}
        }
      },
      "System.Reactive.Core/3.1.1": {
        "type": "package",
        "dependencies": {
          "System.Reactive.Interfaces": "3.1.1"
        },
        "compile": {
          "lib/net46/System.Reactive.Core.dll": {}
        },
        "runtime": {
          "lib/net46/System.Reactive.Core.dll": {}
        }
      },
      "System.Reactive.Interfaces/3.1.1": {
        "type": "package",
        "compile": {
          "lib/net45/System.Reactive.Interfaces.dll": {}
        },
        "runtime": {
          "lib/net45/System.Reactive.Interfaces.dll": {}
        }
      },
      "System.Reactive.Linq/3.1.1": {
        "type": "package",
        "dependencies": {
          "System.Reactive.Core": "3.1.1"
        },
        "compile": {
          "lib/net46/System.Reactive.Linq.dll": {}
        },
        "runtime": {
          "lib/net46/System.Reactive.Linq.dll": {}
        }
      }

Could you share the nuget.exe ouput with specifying -verbosity detailed?

@jairbubbles
Copy link
Author

jairbubbles commented Sep 12, 2017

Thx for looking into it!

That's weird, I can reproduce it on my home pc too.

  • Are you using the good nuget.exe ? (ie the one from the zip). To be sure I'm now using powershell command: ./nuget.exe restore projects/win64/maxhammer.vs2017.sln -verbosity detailed
  • Please note that there are two projects starting with Anvil and it works correctly for the other one (Anvil.System)
  • This bug is very subtle. On my attempt to build a simple repro case, I often ended up with a perfectly working example.

Here is the content of source\anvil\AnvilControls\obj\project.assets.json:

{
  "version": 3,
  "targets": {
    ".NETFramework,Version=v4.6.1": {},
    ".NETFramework,Version=v4.6.1/win": {},
    ".NETFramework,Version=v4.6.1/win-x64": {},
    ".NETFramework,Version=v4.6.1/win-x86": {}
  },
  "libraries": {},
  "projectFileDependencyGroups": {
    ".NETFramework,Version=v4.6.1": []
  },
  "packageFolders": {
    "C:\\Users\\jairb\\.nuget\\packages\\": {}
  },
  "project": {
    "version": "1.0.0",
    "restore": {
      "projectUniqueName": "C:\\Users\\jairb\\Desktop\\NuGetRestoreBug\\source\\anvil\\AnvilControls\\Anvil.Controls.vs2017.csproj",
      "projectName": "Anvil.Controls",
      "projectPath": "C:\\Users\\jairb\\Desktop\\NuGetRestoreBug\\source\\anvil\\AnvilControls\\Anvil.Controls.vs2017.csproj",
      "packagesPath": "C:\\Users\\jairb\\.nuget\\packages\\",
      "outputPath": "C:\\Users\\jairb\\Desktop\\NuGetRestoreBug\\source\\anvil\\AnvilControls\\obj\\",
      "projectStyle": "PackageReference",
      "skipContentFileWrite": true,
      "configFilePaths": [
        "C:\\Users\\jairb\\AppData\\Roaming\\NuGet\\NuGet.Config",
        "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
      ],
      "originalTargetFrameworks": [
        ".NETFramework,Version=v4.6.1"
      ],
      "sources": {
        "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
        "C:\\Users\\jairb\\.dotnet\\NuGetFallbackFolder": {},
        "https://api.nuget.org/v3/index.json": {}
      },
      "frameworks": {
        "net461": {
          "projectReferences": {}
        }
      },
      "warningProperties": {
        "allWarningsAsErrors": true
      }
    },
    "frameworks": {
      "net461": {}
    },
    "runtimes": {
      "win": {
        "#import": []
      },
      "win-x64": {
        "#import": []
      },
      "win-x86": {
        "#import": []
      }
    }
  }
}

Here is the log file: log.txt

@zhili1208
Copy link
Contributor

Thanks for clarifying. I was looking at wrong project, I can repro with AnvilControls. @emgarten Could you take a quick look?

@emgarten
Copy link
Member

This looks similar to #5855

The workaround is to ensure that all references to the project have the same casing, including the solution.

@jairbubbles
Copy link
Author

It's very unlikely as we use a tool to generate our projects.

@jairbubbles
Copy link
Author

@emgarten Indeed you were right!

One .vcxproj references our project and he's missing some uppercase caracters:

<ProjectReference Include="..\..\..\..\source\anvil\anvilcontrols\Anvil.Controls.vs2017.csproj">

When replaced by

<ProjectReference Include="..\..\..\..\source\anvil\AnvilControls\Anvil.Controls.vs2017.csproj">

The restore works correctly 😄

I think I had a hard time reproducing in a simple repro case as I was editing with Visual Studio and I guess it was automatically fixing the case when the .vcxproj was saved.

@emgarten
Copy link
Member

Glad you got it working! This has been fixed for the next release.

@jairbubbles
Copy link
Author

Will you make it available before next VS release on https://www.nuget.org/downloads ?

@emgarten
Copy link
Member

@jairbubbles for which component?

@jairbubbles
Copy link
Author

I'm not sure of what you're asking. Just nuget.exe ?

@emgarten
Copy link
Member

//cc @rrelyea for nuget.exe 4.4 preview plan

@rrelyea rrelyea added Product:NuGet.exe NuGet.exe Resolution:Duplicate This issue appears to be a Duplicate of another issue labels Sep 14, 2017
@rrelyea rrelyea added this to the 4.4 milestone Sep 14, 2017
@rrelyea
Copy link
Contributor

rrelyea commented Sep 14, 2017

This will be fixed in NuGet 4.4.0 preview 3 and later.
It which will ship in NuGet.exe once preview3 ships. That will be at nearly the same time as Visual Studio 15.4 preview 3 shipping. Preview 2 shipped on 9/11. Preview 3 will likely ship later in September or early October. (watch for preview 3 here: https://www.visualstudio.com/en-us/news/releasenotes/vs2017-Preview-relnotes)

@rrelyea rrelyea closed this as completed Sep 14, 2017
@rrelyea rrelyea changed the title Nuget.exe restore on VS2017 seems to ignore <PackageReference> Dupe: casing problems of ProjectReference can cause nuget.exe restore to fail. Fixed in 4.4. Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Restore Product:NuGet.exe NuGet.exe Resolution:Duplicate This issue appears to be a Duplicate of another issue
Projects
None yet
Development

No branches or pull requests

4 participants