-
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
vsfeedback: msbuild /t:restore fails on ProjA (packageRef/.net461) w/ ref to ProjB (.netstandard) #4532
Comments
This one is a dupe of #4515,
|
the issue is during msbuild build, 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. |
@zhili1208 and i worked on the workaround.
|
We are seeing this issue as well. 2 .NET framework 4.6.2 libraries. I've found the main difference I can see between a VS17 restore packages, which works, to a Here is a snippet of what Restore Packages in VS17 generates for the
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 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 |
@jabrown85 you mentioned "VS17 restore packages and regular nuget restore? Does "regular nuget restore" mean nuget.exe restore? VS17 restore packages means "auto restore"? |
Yes exactly. Restoring via the VS17 solution context menu works. Using nuget cli directly does not.
|
@jabrown85 I can repro your issue, but the workaround above works for me, Did you put that under project node in your B.csproj? |
I feel like I did. I recall putting it in both projects to be safe.
…On Fri, Feb 17, 2017 at 4:36 PM Zhi Li ***@***.***> wrote:
@jabrown85 <https://github.com/jabrown85> I can repro your issue, but the
workaround above works for me, Did you put that in your B.csproj?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4532 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAwR1zChEQRN52i49TpvcUw_bqG65JQaks5rdiECgaJpZM4L7GVl>
.
|
Related to #4629 |
the difference between nuget.exe restore and VS solution restore is project.assert file from nuget.exe restore contains "compile section" for A.csproj. This will hit the "ProjectReferencesCreatingPackages" Null issue. @jabrown85 Can you verify the workaround again? Because the workaround totally skip the "ResolveNuGetPackageAssets", it should not hit that again. Following is one example:
|
I can confirm the workaround does not work for me. In the project I was working with I get errors regarding the assemblies referenced in project B that should be pulled down from NuGet for project B (xUnit/NSubstitute). I don't see any compilation errors referencing project A NuGet dependencies. I'm not entirely clear on what the workaround is trying to accomplish but if it's skipping restore entirely for project B that would explain it. I need project B to bring in project A's NuGet packages AND restore project B's direct NuGet packages. |
I see, so looks like the workaround avoided the "but an output path was not specified on an item in the ProjectReferencesCreatingPackages property" error but will got Project B NuGet dependencies error. will look into that. thanks for your infomation |
I've been trying to get around this, as this completely breaks a build server scenario, making the new projet format unusable. It seems that the code in the NuGet.PackageManager assembly, which is used by VS2017, is interacting differently with the restore process, and it's also not adding "placeholder" paths I can see when running the restore from the command line. VS produces:
and Nuget CLI produces:
The workaround specified above prevents any of the dependencies to be added to the build, so it's not working either. Is there any other possible workaround ? |
I didn't find a good workaround for this, if you remove following section from asset file:
it will work, otherwise we need a fix in NuGet.BuildTasks |
@jeromelaban The workaround I've got in place is not ideal but works. Project B has to revert and use the packages.config style NuGet. The build server then becomes |
@jabrown85 Thanks for the workaround! Though I won't be able to use it in my case, since I'm using the Even I were not to be using this, the fact that I'll try to write probably write a small task that sits before the |
@jeromelaban can you post your msbuild task for others if you do indeed go that route? I assume it'll help out others in the same position. |
I put a workaround for the project.json issue based on code @bbowman wrote on this MyGet feed |
I have created a repo demonstrating the issue with pure VS 2017 projects |
NuGet restore is broken in non-.NETCore projects with project references: NuGet/Home#4532
@onovotny That workaround package worked great! |
@ctaggart glad it worked!! Hopefully it'll get fixed for real soon :-) |
VS 15.1 is out, but this fix doesn't seem to have been released. |
Yes, it would be nice to know as soon as we can remove workarounds from our projects. Will you update us? |
@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 |
|
That didn't help, but I'll file a more-specific issue. |
|
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. |
Okay. So we're still tracking this bug. And I bet its far down on the Github issues page because its so old. Sigh. |
vsfeedback 801748 & https://developercommunity.visualstudio.com/content/problem/17821/restoring-packages-from-vs-and-from-the-msbuild-re.html
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 text was updated successfully, but these errors were encountered: