-
Notifications
You must be signed in to change notification settings - Fork 390
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
Make the PackageReference support general purpose for all languages #2491
Comments
Is there an update on when the "Microsoft.PackageDependency.Sdk` will ship @natidea? I'm on 15.6 Preview 3 but it's not there yet :( |
@kzu our most recent discussions on this have focused on refactoring these tasks because of performance concerns. The SDK team has already made changes to the command line build to avoid this code path because it was too expensive. For the dependencies tree, we are considering several options including perhaps bypassing MSBuild to improve the performance profile. /cc @nguerrera @livarcocc I don't have any other updates yet, but will post something as our plans unfold. |
Is there an update on this issue? We have a custom project system for which we really need to support Thanks in advance. |
Ditto, would love to see this happen 👍 |
We are providing guidance to package build tools as NuGet & use package reference to pull it down while using build/restore. If CPS doesn't support this for custom project types, then its an adoption blocker & lot of overhead for developers who intend to quickly use this to build project systems. Would love to get this prioritized or hear about a workaround that can be easily removed once the support comes back. |
Since it's a blocker for sfproj supporting SDK-style, shouldn't this be triaged a bit higher than 'Unknown/Backlog'? |
Any update on this one? |
Any updates on this one? Unblocking microsoft/service-fabric#885 will be helpful. |
This replaces the MSBuild item with a MEF service, that has the added advantage of being tied to a project capability, allowing it to be loaded in project types that have not imported our Managed.DesignTime.targets. This is a part of dotnet#2491.
I've run into problems when adding nuget references into the .wapproj, nuget will add the assemblies as references, which causes the .wapproj to fail. just want to mention it in case this scenario needs to be tested |
Have you tried again? We added the ProjectReferences capability to wapproj a few weeks back. I don't know whether that will make it work for you. |
@davkean I saw the 16.8 Preview 4 bits up today and tried them out on our VM with our actual custom CPS-based project system (that also uses a custom MSBuild SDK). It seems to be working. I can now see the So, is there outstanding work to be done on this issue (and the others that fan out from this one)? Definitely unblocks us, it seems. Are there more scenarios I should test or that may be helpful in verifying your work on this? Thanks in advance. |
Hey @edwardskrod when can we expect this to work for C++ projects? |
@asklar As it turns out, PackageReference support in C++ projects works today. You will need to do the following:
After that, not only will NuGet packages auto-restore like with csproj, but the NuGet Package Manager UI will also add and remove PackageReference elements from the project instead of creating a packages.config file. (If this doesn’t seem to work, you may need to use the VS 16.11 beta; that’s what I’m using, and it works great for me.) Note that vcxproj will require you to run File > Save All before changes made in the NuGet UI will persist to the project file, as with any other changes to a vcxproj made using the GUI. Hope this helps! |
we should try this out! thanks for the tip @wjk ! |
@wjk I tried this in our project but couldn't get it to work. It complains about a missing framework reference. I prepared a minimal MSVC solution to reproduce this. Could you please take a look in case I'm missing anything? https://github.com/jurocha-ms/vcpkgref-sample What I tried with a 100% clean clone:
Sample error output:
So far, using the MSBuild properties Note, using MSBuild |
@JunielKatarn My apologies, I forgot a step. Add this to the .targets file, above the MSBuildExtensionsPath import. <PropertyGroup>
<ResolveNuGetPackages>false</ResolveNuGetPackages>
</PropertyGroup> |
Is any of this documented / stable enough? I couldn't find any docs on this on my cursory search so I worry about relying on implementation details that could change. @rainersigwald ? |
@asklar After a quick test, I have found that the |
@wjk That worked. Thanks a bunch. |
For anyone interested, I needed to use one more hack to make the PackageReference C++ NuGet restore work in VS2022, as described in this comment:
|
@beevvy We use that configuration too in react-native-windows. I believe it's required for mixed C++ and C# interoperability. |
I should also note that setting |
Hi all, is anyone having issues referencing a C++/CLI with package references from a C# project ? My C++/CLI project compiles ok with .NETFramework 4.8, but I get the following issue from the C# project that references it: error NU1201: Project MyCppCLIProject is not compatible with net48 (.NETFramework,Version=v4.8). Project MyCppCLIProject supports: native (native,Version=v0.0) |
Can someone please post a guide how to get Packagereference work for .vcxproj (native and c++/cli) with visual studio? |
and later in the blog post
So, PackageReference should "just work" for C++/CLI projects, if you're using a recent version of VS2022 and you're targeting .NET (Core). It's unclear what happens if you're using C++/CLI and still targeting .NET Framework. PackageReference for native C++ isn't supported. |
Yes, i know. But we have native C++ Nugets and C++/CLI Nugets using .NET Framework. So I am interested in the existing workaround, which may not be officially supported. |
We added support for
<PackageReference />
this release, but other languages/project types are interested in consuming it including C++, MSIX deployment and NuGetizer.The work required, that I can see is:
NuGet features should light up for projects that have the capability; "PackageReferences" NuGet/Home#9957, Enable custom CPS projects to be restored NuGet/NuGet.Client#3644)<ProjectAssetsFile>
needs to be moved lower than the SDKThe text was updated successfully, but these errors were encountered: