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

Package restore of sln fails, but each individual project succeeds #4753

Closed
AArnott opened this issue Mar 6, 2017 · 5 comments
Closed

Package restore of sln fails, but each individual project succeeds #4753

AArnott opened this issue Mar 6, 2017 · 5 comments
Labels
Functionality:Restore Resolution:NotRepro We are not able to reproduce this problem. Better steps would be helpful.
Milestone

Comments

@AArnott
Copy link
Contributor

AArnott commented Mar 6, 2017

d15rel 26228.0

git clone https://github.com/aarnott/pinvoke
cd pinvoke
git checkout bugrepro/roslyn-project-system/1678
cd src
msbuild /t:restore

Package restore mostly succeeds, but fails with these two errors:

   "C:\git\pinvoke\src\PInvoke.sln" (restore target) (1) ->
  (Restore target) ->
    C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(97,5): error : Unable to resolve 'C:\git\pinvoke\src\NtDll\NtDll.csproj' for '.NETFramework,Version=v4.6'. [C:\git\pinvoke\src\PInvoke.sln]
    C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(97,5): error : Unable to resolve 'C:\git\pinvoke\src\Wtsapi32\Wtsapi32.csproj' for '.NETFramework,Version=v4.0'. [C:\git\pinvoke\src\PInvoke.sln]

Yet when I do a package restore on each individual project in the solution, I get no errors:

gci *csproj -rec |% { write-host -foreground green $_; msbuild /nologo /m /v:minimal /t:restore $_ }
@jonasric
Copy link

jonasric commented Apr 7, 2017

I'm experiencing the same issue, where using MSBuild /t:Restore to restore many projects together is failing with error similar to: "error : Unable to resolve '<my common .csproj>' for '.NETFramework,Version=v4.5'.

In my case, this error appears for several projects, and they're all referring to the same <my common .csproj>, which is a common project that almost all other projects reference (by ProjectReference).

Some projects that were failing to restore with this error succeeded when I restored them individually, as mentioned in the OP. However, other projects still fail with the same error even when I restore them (with msbuild /t:restore) individually.

Is there a known workaround that I can try until a fix is ready?

@emgarten emgarten added this to the 4.5 milestone Oct 18, 2017
@emgarten emgarten added Resolution:NotRepro We are not able to reproduce this problem. Better steps would be helpful. Functionality:Restore labels Oct 18, 2017
@emgarten
Copy link
Member

emgarten commented Oct 18, 2017

I'm not able to repro this in NuGet 4.4/VS 15.4 using the steps above. This is has likely been fixed.

Let me know if you are seeing this issue still.

@AArnott
Copy link
Contributor Author

AArnott commented Oct 18, 2017

Agreed. This is gone in the latest builds. Thanks.

@jonasric
Copy link

To close the loop on this one- yes it is gone. After some more investigation and experimentation, I found the issue I was experiencing was related to #2901. Namely, when some common project is referenced by multiple other projects in the dependency graph, using ProjectReference items but with different string-casing (e.g one project references 'SomeCommonProject.csproj', and another references 'somecommonproject.csproj'), the issue happens. After normalizing the casing of all ProjectReference references, the issue was resolved for me.

@emgarten
Copy link
Member

@jonasric you were likely hitting #5855

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Restore Resolution:NotRepro We are not able to reproduce this problem. Better steps would be helpful.
Projects
None yet
Development

No branches or pull requests

3 participants