-
Notifications
You must be signed in to change notification settings - Fork 249
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
NuGet restore fails with .NET452 -> UAP ref (valid for UWP designer) #5915
Comments
@rohit21agrawal is doing some initial investigation here. |
@dotMorten @onovotny the issue here is that NuGet has never checked for Project Reference compatibility in the packages.config world but it does so in the PackageReference world - which is what you are seeing. a net452 -> uap10.0 reference is incompatible. Even with the packages.config workaround, are you able to build your project? I would be surprised if you are able to. |
@rohit21agrawal Yes, this is how the UWP design-time assemblies are built. |
not sure what NuGet can do here. if we stop looking at compat between project references, apart from violating package-project duality , we will also not be able to flow dependencies transitively since we won't know what's compatible with what. |
How about being able to define an explicit opt-out in the package reference? |
could you elaborate more? are you talking about opting-out of compatibility check for P2P references? |
Yeah something along the lines of this: <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" CompatibilityCheck="False">
<Version>5.4.0</Version>
</PackageReference> ...or a platform override: <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" ForceTargetPlatform="uap10.0">
<Version>5.4.0</Version>
</PackageReference> |
I suggest adding a <PropertyGroup>
<ValidateFrameworkCompatibility>false</ValidateFrameworkCompatibility>
</PropertyGroup> Having this option on a per item basis requires a resolving conflicting settings across the dependency graph. For example if a package has compat turned off it makes sense that the transitive dependencies are also ignored, but if another package has the same dependencies it isn't obvious how those are treated. The same applies to turning off compat only for projects or only for packages. If compat it ignored for a project then the transitive package dependencies from that project would also need to be ignored since they could be meant for an incompatible TFM, and the same thing as above occurs again. For that reason I think this should be a simple on/off. If you need to do custom things that require breaking basic compat rules you can disable the checks but need to be very careful to avoid runtime problems that could result. |
I'll absolutely admit this is an edge-case and could/should require some kind of property to override default settings and enable this. |
I worked around it by using a good old assembly reference instead of a project reference. Not pretty but it unblocks us |
I like the Given that this is a very rare scenario, I'd prefer to minimize investment in this area. When @rohit21agrawal, @emgarten and I are all in the same place at the same time, we'll discuss the options a bit... |
@onovotny @dotMorten there is one more work around that could potentially make this work if you want to give this a try:
Let me know if this works for you. |
Yes, we aren't planning more work here. Using a ProjectReference with Condition="'$(ExcludeRestorePackageImports)' != 'true'" is probably the most elegant way to make project reference be ignored by NuGet restore. |
@rrelyea @rohit21agrawal @emgarten Thanks for all the suggestions. Just circling back now. However, the bad news is none of that works when building from the commandline. I'm still getting compile time errors there.
Branch is updated with my changes: https://github.com/Microsoft/UWPCommunityToolkit/compare/dotMorten/DesignAssembly |
it looks like SDK is doing TFM compatibility check too. @nguerrera @dsplaisted any ideas? |
Yes, the SDK does TFM compatibility checks, and with dotnet/msbuild#2595 MSBuild will be doing them instead. |
This is a blocker as a .NET -> UWP reference is valid for the purpose of creating designer controls. |
@dsplaisted Is there any workaround we can do so the UWP toolkit can get design-time assembly support checked in? |
also, @dotMorten i am interested in knowing why ProjectReference didn't work for you with ExcludeRestorePackageImports set? can you show the restore errors you got there? |
@rohit21agrawal The project reference with ...and that is with |
CC: @unniravindranathan - the workaround that nuget provided is potentially going to be unusable if SDK (and eventually msbuild) is going to be doing compatibility checks as well. @dsplaisted is there a way to opt out of compatibility check that SDK (and eventually msbuild ) does? |
Looking at the MSBuild code, I think you can set the metadata |
@dsplaisted You're a friggin superhero! It even makes the project reference work! |
awesome! glad this is resovled! Thanks @dsplaisted |
@dotMorten has been trying to implement designers for the UWP Toolkit controls. The pattern here is that the designer project is .NET Framework project that references a UWP control library project. This seems to fail with PackageReference:
https://github.com/Microsoft/UWPCommunityToolkit/commits/dotMorten/DesignAssembly
This was from the above branch calling
msbuild /t:restore
on the design project. This is a blocker for the toolkit… any workarounds?The text was updated successfully, but these errors were encountered: