You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vsfeedback: msbuild /t:restore fails on ProjA (packageRef/.net461) w/ ref to ProjB (.netstandard) #4532
Given two net45 projects referencing, one referencing the other, if second is using the new way of declaring itss nuget dependencies using the new declaration style, restoring via "msbuild /t:restore" will fail the build, and from the VS context menus, the build will pass.
When restored from the command line, the subsequent build error is the following: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets(197,5): error : The project.json is referencing the project 'E:\Agent01\1\s\src\XXX\XXXe (net45)\XXX (net45).csproj', but an output path was not specified on an item in the ProjectReferencesCreatingPackages property. [E:\Agent01\1\s\src\XXX.Tests\XXX.Tests.csproj]
Rob: sounds like Proj1 depends on Proj2. Proj2 uses PackageReferences?
the issue is during msbuild build,
In C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets
it check ".xproj" extension to get ProjectReferencesCreatingPackages, since there is no xproj project, ProjectReferencesCreatingPackages is not specified.
nuget doesn't own this code, need to ask other team to fix this.
changed the title [-]vsfeedback: msbuild /t:restore fails on 2 project solution w/ packageref[/-][+]vsfeedback: msbuild /t:restore fails on ProjA (packageRef/.net461) w/ ref to ProjB (.netstandard)[/+]on Feb 9, 2017
So you'll notice where the VS17 restore packages has the dependencies tree directly in the root of the project (and also under frameworks.net462) but the regular nuget restore does not have the dependencies tree at the root of the project node.
What could cause these differences? I was under the impression VS17 was using NuGet 4.0.
If this is an issue that is to be fixed in a new drop, can anyone think of a workaround? The one above does NOT work for me.
For anyone else who comes by, I had to actually convert one of the projects to the packages.config style of nuget instead of the packagereference style. Then, I had to nuget restore prior to calling msbuild /t:restore;build.
@jabrown85 you mentioned "VS17 restore packages and regular nuget restore?
Could you explain more about that? what's "VS17 restore packages" and "regular nuget restore"?
Does "regular nuget restore" mean nuget.exe restore? VS17 restore packages means "auto restore"?
@gulbanana@jnm2 I just checked VS 15.1, this fix is in that release, and I can't repro this issue any more. If you still hit the problem and get same error message, the msbuild might not be updated for some reason on your machine. If you get other error message, Please share the log, then I can take a look. thanks
@zhili1208 I was just waiting to see some release note confirming that it was time to try again. Just now, tested working on 15.1.26303.3! This resolves the project.json(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1. issue because now there is no more reason to use project.json with traditional csproj. I'm quite happy with how quickly this was resolved, only a month! Thank you!
dotnet msbuild -version returns 15.1.1012.6693
The problem I have is actually "Your project.json doesn't have a runtimes section.", which I thought was closed as a duplicate of this issue, but it might actually just be a misleading message. I'll try adding some <RuntimeIdentifiers> to my PackageReference-using old csprojes..
I'm upgrading my .net 4.0 app to 4.7 and I referenced Roslyn and it's putting it in packagereferences instead of packages.config and my build is blowing up pretty hard... I called msbuild /t:restore but build still fails from the cli. Any ideas on how to resolve this in 15.2?
Another internal customer just hit this error with "ProjectReferencesCreatingPackages" -- when they had vs 2017 15.0 on their CI machine. Updating the CI machine to VS 2017 15.2 fixed it for them.
Activity
zhili1208 commentedon Feb 8, 2017
This one is a dupe of #4515,
Repro step:
zhili1208 commentedon Feb 8, 2017
the issue is during msbuild build,
In C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\NuGet\15.0\Microsoft.NuGet.targets
it check ".xproj" extension to get ProjectReferencesCreatingPackages, since there is no xproj project, ProjectReferencesCreatingPackages is not specified.
nuget doesn't own this code, need to ask other team to fix this.
rrelyea commentedon Feb 9, 2017
@zhili1208 and i worked on the workaround.
putting the following in your csproj after the targets import, avoids the build error in the simple case.
very weird that VS2017 targets still mention .xproj at all. Need to figure out how to address for 4.0.1 --
in Microsoft.NuGet.Targets (https://github.com/NuGet/NuGet.BuildTasks/blob/776bb2b300e1333a6bc3297d441eabba2d640264/src/Microsoft.NuGet.Build.Tasks/Microsoft.NuGet.targets)
[-]vsfeedback: msbuild /t:restore fails on 2 project solution w/ packageref[/-][+]vsfeedback: msbuild /t:restore fails on ProjA (packageRef/.net461) w/ ref to ProjB (.netstandard)[/+]jabrown85 commentedon Feb 15, 2017
We are seeing this issue as well. 2 .NET framework 4.6.2 libraries.
AandB.Ahas a bunch of nuget references.I've found the main difference I can see between a VS17 restore packages, which works, to a
nuget restoreis theproject.assets.json.Here is a snippet of what Restore Packages in VS17 generates for the
project.assets.jsonfor projectB. This is the project that fails to compile.Here is what nuget restore looks like (paths redacted, but I can get those if they seem important)
So you'll notice where the VS17 restore packages has the
dependenciestree directly in the root of theproject(and also underframeworks.net462) but the regularnuget restoredoes not have thedependenciestree at the root of theprojectnode.What could cause these differences? I was under the impression VS17 was using NuGet 4.0.
If this is an issue that is to be fixed in a new drop, can anyone think of a workaround? The one above does NOT work for me.
jabrown85 commentedon Feb 16, 2017
For anyone else who comes by, I had to actually convert one of the projects to the packages.config style of nuget instead of the packagereference style. Then, I had to
nuget restoreprior to callingmsbuild /t:restore;build.zhili1208 commentedon Feb 17, 2017
@jabrown85 you mentioned "VS17 restore packages and regular nuget restore?
Could you explain more about that? what's "VS17 restore packages" and "regular nuget restore"?
Does "regular nuget restore" mean nuget.exe restore? VS17 restore packages means "auto restore"?
jabrown85 commentedon Feb 17, 2017
zhili1208 commentedon Feb 17, 2017
@jabrown85 I can repro your issue, but the workaround above works for me, Did you put that under project node in your B.csproj?
37 remaining items
Revert projects back to packages.config due to bugs:
Apply build break workaround NuGet/Home#4532
gulbanana commentedon Apr 10, 2017
VS 15.1 is out, but this fix doesn't seem to have been released.
jnm2 commentedon Apr 10, 2017
Yes, it would be nice to know as soon as we can remove workarounds from our projects. Will you update us?
zhili1208 commentedon Apr 10, 2017
@gulbanana @jnm2 I just checked VS 15.1, this fix is in that release, and I can't repro this issue any more. If you still hit the problem and get same error message, the msbuild might not be updated for some reason on your machine. If you get other error message, Please share the log, then I can take a look. thanks
jnm2 commentedon Apr 10, 2017
@zhili1208 I was just waiting to see some release note confirming that it was time to try again. Just now, tested working on 15.1.26303.3! This resolves the
project.json(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.issue because now there is no more reason to use project.json with traditional csproj. I'm quite happy with how quickly this was resolved, only a month! Thank you!gulbanana commentedon Apr 11, 2017
dotnet msbuild -versionreturns 15.1.1012.6693The problem I have is actually "Your project.json doesn't have a runtimes section.", which I thought was closed as a duplicate of this issue, but it might actually just be a misleading message. I'll try adding some
<RuntimeIdentifiers>to my PackageReference-using old csprojes..gulbanana commentedon Apr 11, 2017
That didn't help, but I'll file a more-specific issue.
emgarten commentedon Apr 11, 2017
dotnet msbuilddoes not support old style csprojs.Revert projects back to packages.config due to bugs:
Revert projects back to packages.config due to bugs:
niemyjski commentedon May 22, 2017
I'm upgrading my .net 4.0 app to 4.7 and I referenced Roslyn and it's putting it in packagereferences instead of packages.config and my build is blowing up pretty hard... I called msbuild /t:restore but build still fails from the cli. Any ideas on how to resolve this in 15.2?
rrelyea commentedon Jun 28, 2017
Another internal customer just hit this error with "ProjectReferencesCreatingPackages" -- when they had vs 2017 15.0 on their CI machine. Updating the CI machine to VS 2017 15.2 fixed it for them.
ericnewton76 commentedon Dec 15, 2018
Okay. So we're still tracking this bug. And I bet its far down on the Github issues page because its so old.
Sigh.