-
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
PackageRef project opt-in technique #4488
Comments
This is going to be a very common scenario. People are creating new .NET Standard projects and will add p2p refs to them from their existing "legacy" projects. -- Xamarin, Desktop, etc. The right binaries won't be in the output directory and people will be confused by this broken behavior. The only workaround is that you have to add |
This user ran into it also: dotnet/sdk#757 (comment) |
As another workaround if <PackageReference Include="Legacy2CPSWorkaround" Version="1.0.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference> |
What do you mean if |
It isn't going away for NetCore projects. |
@rrelyea Will there be a way to force a .NET Framework (non-CPS) project into PackageReference mode without actually adding a PackageReference item? |
Another current workaround: |
@rrelyea does that placeholder have to exist? will there be restore errors/failures if it's not there? |
I was just trying to find a workaround that involved a Clearly, we want a more elegant solution. |
Just wasn't sure with Update what happens if it tries to update a package that doesn't exist. |
I think both remove and update are ok to do with package names that don't exist. |
@rrelyea I tried the suggestion of using The only thing that's worked so far is to use: <PackageReference Include="Legacy2CPSWorkaround" Version="1.0.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference> |
Another report: dotnet/roslyn#17639 |
@jainaashish - We've been able to re-enable RestoreProjectStyle, in 4.1 already, right? |
Yes, we've re-enabled RestoreProjectStyle property in 4.1 |
Per @rrelyea (this is rob typing) - let's spend a few hours this sprint (or soon) and discuss possible solutions and all aspects of the related problem - for new projects, old projects, etc... |
Solved the same issue with the same workaround from @James-Lester with a .net 4.7.1 project referencing a .net standard 2.0 library. |
At this point, I don't think there's a product action that needs to be taken. Let me know if anyone disagrees. |
The issue is that transitive refs with PackageRef isn’t working with P2P refs between CPS and Legacy projects. With PackageRefs, this is supposed to be supported.
So build the attached project. Try to run Net46ConsoleAppLegacy.exe. It throws due to a missing Newtonsoft.json. Look at the bin\debug directory and you’ll see that the json ref is missing from the output.
By contrast, look at the Net46ConsoleAppCPS project and you’ll see that things work correctly.
There are a few issues in the legacy project:
Both of these work from the CPS version. This is very weird behavior to have a difference like this.
I get that P2P transitive refs are “new” for CPS, but transitive NuGet refs are not new and work today in VS 2015 with csproj+json. At the very least, I expect #2 to work and for the correct binaries to be in the output directory even if I cannot use types from ClassLibraryWithPackage in Net46ConsoleAppLegacy. The better scenario is that P2P should fully work here too and the Program.cs code in the CPS and Legacy version of the net46 exe should be the same.
SampleSolution.zip
The text was updated successfully, but these errors were encountered: