Repository navigation
Closed
Labels
Milestone
Description
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
Restoring packages for C:\Users\*USER*\AppData\Local\Temp\u5vck04v.wg2\u5vck04v.wg2.csproj...
Writing lock file to disk. Path: C:\Users\*USER*\AppData\Local\Temp\u5vck04v.wg2\obj\project.assets.json
Generating MSBuild file C:\Users\*USER*\AppData\Local\Temp\u5vck04v.wg2\obj\u5vck04v.wg2.csproj.nuget.g.targets.
Generating MSBuild file C:\Users\*USER*\AppData\Local\Temp\u5vck04v.wg2\obj\u5vck04v.wg2.csproj.nuget.g.props.
Restore completed in 2382.5973ms for C:\Users\*USER*\AppData\Local\Temp\u5vck04v.wg2\u5vck04v.wg2.csproj.
NuGet Config files used:
C:\Users\*USER*\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
C:\Users\*USER*\AppData\Local\Temp\0amxhhhs.f0v
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: The "RestoreTask" task failed unexpectedly.\r [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: System.InvalidOperationException: Sequence contains more than one matching element\r [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)\r [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.GetPackageSpec(IEnumerable`1 items)\r [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()\r [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: at NuGet.Commands.MSBuildRestoreUtility.GetDependencySpec(IEnumerable`1 items)\r [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: at NuGet.Build.Tasks.RestoreTask.Execute()\r [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130\NuGet.targets(70,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [C:\Users\*USER*\Source\Repos\Project\Solution.sln]
Environment data
dotnet --info output:
.NET Command Line Tools (1.0.0-preview4-004130)
Product Information:
Version: 1.0.0-preview4-004130
Commit SHA-1 hash: a0060ac321
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10240
OS Platform: Windows
RID: win10-x64
Base Path: c:\users\*USER*\Downloads\dotnet-dev-win-x64.latest\sdk\1.0.0-preview4-004130
Activity
rrelyea commentedon Jan 18, 2017
@twsouthwick - do you have a sample project that shows this problem?
twsouthwick commentedon Jan 18, 2017
I don't have one at the moment. If I remember, I ran
dotnet restoreagainst the.slnand got this error. When I ran it against the.csprojfor the specific project, it restore correctly. If this description isn't enough to get a repro, I can try to put one together.emgarten commentedon Jan 19, 2017
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
rrelyea commentedon Jan 25, 2017
didn't repro the invalid operation exception at all, either.
dotnet restore is not aware of Packages.config.
@twsouthwick - Is that the scenario you ran into. If so, please use Nuget.exe restore instead.
rrelyea commentedon Jan 26, 2017
Closing as not repro. @twsouthwick - would love more data or validation when you can.
swoog commentedon Jan 31, 2017
I have the same issue on the project https://github.com/swoog/Pattern/tree/develop
emgarten commentedon Jan 31, 2017
@swoog what version of dotnet CLI are you using?
26 remaining items
[-]RestoreTask fails with InvalidOperationException [/-][+]Dotnet Restore foo.sln -- fails when configurations in SLN cause duplicate (but diff config) projects in restore graph[/+]iskiselev commentedon Feb 9, 2017
@rrelyea, is nuget.exe 4.0 publicly accessible somewhere to workaround this problem?
clairernovotny commentedon Feb 9, 2017
I'm still hitting this in RC4...and it's blocking me with xUnit for Devices:
https://github.com/xunit/devices.xunit/blob/master/xUnit.Devices.sln
I'm trying to call
msbuild /t:restore xunit.devices.slnand get:iskiselev commentedon Feb 9, 2017
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.
Handle duplicate MSBuild items during restore
emgarten commentedon Feb 9, 2017
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
rrelyea commentedon Feb 9, 2017
Please finish PR review/feedback (if any).
Then ensure you've tested it all it needs.
Then merge into dev.
twsouthwick commentedon Feb 10, 2017
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.
kzu commentedon Feb 20, 2017
I'm seeing this in the latest VS2017RC too. Any ideas when this will hit the stable channel?
Repro: clone & run
msbuild /t:restorein folder https://github.com/NuGet/NuGet.Build.Packaging/tree/9de80814eadc29d15b27c4a674139a53b71a2558/src/BuildVersion information:
Use AnyCPU as the target platform
Use AnyCPU as the target platform
Use AnyCPU as the target platform