-
Notifications
You must be signed in to change notification settings - Fork 258
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
Dotnet Restore foo.sln -- fails when configurations in SLN cause duplicate (but diff config) projects in restore graph #4316
Comments
@twsouthwick - do you have a sample project that shows this problem? |
I don't have one at the moment. If I remember, I ran |
It looks like something is auto generating a project and referencing it, and that project doesn't contain valid properties for nuget. @twsouthwick a repro would be helpful |
didn't repro the invalid operation exception at all, either. dotnet restore is not aware of Packages.config. |
Closing as not repro. @twsouthwick - would love more data or validation when you can. |
I have the same issue on the project https://github.com/swoog/Pattern/tree/develop |
@swoog what version of dotnet CLI are you using? |
The same as 1.0.0-preview4-004130 |
@emgarten I ran into this as well using today's nightly build of CLI, 1.0.0-rc4-004769 on aspnet/Configuration. Repro: unzip and run "dotnet restore" in the solution directory. https://github.com/aspnet/Configuration/tree/2519ffc7fc1071befeae021551c6203126e117d3 Source: Configuration-2519ffc7fc1071befeae021551c6203126e117d3.zip |
Also, WriteRestoreGraphTask fails with the same error:
|
I ran a structured logger and found what causes this line of code to throw. You can view this with https://github.com/KirillOsenkov/MSBuildStructuredLog. |
@emgarten - if we have a repro now, would love to know what the problem is...what the impact is...and what the fix would be. |
Marking Shiproom Required, as Nate/Eilon think this is blocking -- seeing errors migrating aspnet/configuration. |
@rrelyea taking a look now. |
I am able to repro this with @natemcmaster's https://github.com/aspnet/Configuration/tree/2519ffc7fc1071befeae021551c6203126e117d3 The repro works both on both
The project Microsoft.Extensions.Configuration.csproj generates a ProjectSpec twice, both are the same from what I see, but they have a different randomly generated guid for the It appears that MSBuild may not be caching the output of this target, and the result is that the duplicate project information is being emitted under different msbuild item include values. I've narrowed when this broke down to:
I don't see any .targets or .props changes that could have caused this when diffing the CLI folders between these two builds. //cc @rainersigwald @jeffkl any idea on what might have caused this? |
@rainersigwald - so what does that mean? |
NuGet fails because the solution has "x86", "x64", and "Any CPU" solution configurations. I can confirm that removing the x86 and x64 from |
so are we saying without this fix, anytime we have anycpu plus any other config, we will fail in restore? |
Also...is this caused to be more prevalent by: dotnet/project-system#1458 |
From talking to @emgarten there are some conflicting requirements here:
My understanding is that the restore traversal already considers TFM as a dimension (and unifies references that are conditional on TFM), but doesn't consider configuration and platform. That makes sense in the new world but in the old world, sln builds care deeply about config/platform. I can see a couple of options here:
The latter seems generally simpler, but I don't understand the NuGet implications deeply.
That's a good question and the answer isn't clear to me at the moment. I'll try to drill in a bit more in the morning. |
I believe the answer is "no", but it might be indirectly related. Looking at the Configuration repro, the issue is caused because the default platform for the DockerSecrets projects is set to I changed that to Diff of .sln after changing "Mixed Platforms" to point to `Any CPU` for DockerSecretsdiff --git a/Configuration.sln b/Configuration.sln
index bc913b0..af124b2 100644
--- a/Configuration.sln
+++ b/Configuration.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26118.1
+VisualStudioVersion = 15.0.26206.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F141E2D0-F9B8-4ADB-A19A-7B6FF4CA19A1}"
EndProject
@@ -444,8 +444,8 @@ Global
{AC7FAD2A-5763-404D-B0FC-3CCA81A16B0A}.Release|x86.Build.0 = Release|Any CPU
{69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|x64.ActiveCfg = Debug|x64
{69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|x64.Build.0 = Debug|x64
{69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Debug|x86.ActiveCfg = Debug|x86
@@ -460,8 +460,8 @@ Global
{69AB0230-D82E-438B-AFE5-85BFF414F1B8}.Release|x86.Build.0 = Release|x86
{82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|x64.ActiveCfg = Debug|x64
{82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|x64.Build.0 = Debug|x64
{82A403ED-F827-4FED-BE38-7F87925A07E1}.Debug|x86.ActiveCfg = Debug|x86 @HaoK do you recall if you did anything special or interesting regarding configurations when you added the DockerSecrets stuff in aspnet/Configuration@2519ffc? If you didn't, whatever caused the default solution configuration to point to the |
Oh, and the answer to "what changed between MSBuild 15.1.523.56541 and 15.1.539.38876 to expose this?" is dotnet/msbuild#1590, which fixed a bug that was causing solution-level restore to not run, in favor of an inefficient jumble of project-level restore invocations. |
I just tried adding a new library to the Configuration sln and it was added as x86, presumably because of dotnet/project-system#1458. So that would indeed exacerbate the problem here--without that, prevalence of solution configurations specifying platform in new projects should be very low. |
I was just hit by this issue and having Any CPU and x64 for the same build configuration caused it, however it is a fully legal configuration, specially if one of the projects depending on some nugets which has platform specific binaries. The funny thing that it was only failing from dotnet.exe command line, VS 2017 RC4 did something differently and handled it somehow. |
@attilah - thanks for the "+1" -- yes, today nuget restore has this problem, but restore in VS and NuGet.exe both avoid this problem. |
@rrelyea, is nuget.exe 4.0 publicly accessible somewhere to workaround this problem? |
I'm still hitting this in RC4...and it's blocking me with xUnit for Devices: I'm trying to call
|
I have the same problem, if configuration of any project doesn't match Solution configuration. So, not only setting Platform=x64 to some project within AnyCpu solution platform, but also setting Release configuration to some projects in Debug solution configuration provokes it. |
This fix improves the robustness of Restore, allowing it to gracefully handle when MSBuild generates duplicate items for the same project. Fixes NuGet/Home#4316
Use nuget.exe to workaround this issue: https://dist.nuget.org/win-x86-commandline/v4.0.0-rc4/nuget.exe Or Visual Studio as @rrelyea mentioned |
Please finish PR review/feedback (if any). |
Can you post when this should end up in an available build? I've got a few projects hitting this and would like to test as soon as it's available. |
I'm seeing this in the latest VS2017RC too. Any ideas when this will hit the stable channel? Repro: clone & run Version information:
|
This avoids an annoying NuGet bug (NuGet/Home#4316) that prevents restore from `msbuild /t:restore`
This avoids an annoying NuGet bug (NuGet/Home#4316) that prevents restore from `msbuild /t:restore`
This avoids an annoying NuGet bug (NuGet/Home#4316) that prevents restore from `msbuild /t:restore`
Moving from dotnet/cli#4857 on behalf of @twsouthwick
Steps to reproduce
This solution has an ASP.NET Core project (targeting .NET 4.6) with a new csproj file and a number of libraries all targeting .NET 4.6 that are still using the old csproj format.
Run
dotnet restore
I can build and run in Visual Studio 2017 RC, but fails at command line.
Expected behavior
Restores correctly
Actual behavior
Environment data
dotnet --info
output:The text was updated successfully, but these errors were encountered: