Replies: 1 comment
-
turns out just after giving the update, i found out how to remove the PackageId before nuget restores the project using this target in <Target Name="RemovePackageId" BeforeTargets="_GenerateRestoreProjectPathWalk" Condition="'$(AssemblyName)' == 'Some.Dependency-0.6.x'">
<PropertyGroup>
<PackageId></PackageId>
</PropertyGroup>
<Message Importance="High" Text="Removed PackageId in Assembly $(AssemblyName)." />
</Target> This is targeting a specific Assembly, but i could probably figure out a way to check if the assembly is within a defined list. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is manually transferred from dotnet/runtime#108343
I have found out a couple days ago that I cannot make use of multi-targeting if any of the underlying dependencies have a
PackageId
Property Declared (Along with a version).For instance, let's say I have 2 projects, which only differ by the target framework & package version :
Now let's say I have a library that support multi-targeting like such :
If I now try to build an app using this Library in an app targeting
net5.0
then I get this error on compilation :if i look inside inside project.assets.json in the obj folder, then i can see this :
For some reasons, Something in the restore process cause something to set the dependency in both target to the latest version of Some.Dependency, instead of the one specified in the condition.
Here is the repo used : https://github.com/Mrcubix/Multi-Targeting-Issue
Any ideas on how I could fix such an issue?
The current workaround I have right now is to create a separate folder for the .NET 6 target and include the source from the other Lib.
Edit: It does not seem like I'm able to remove, override, or modify a
PackageId
usingProperties
,AdditionalProperties
.A potentially overkill workaround
I could potentially build the projects in questions, package them, and use a repo specific local nuget feed to instead reference those packages, as
PackageReference
does not suffer the same issue.However this seems like a lot of extra setup just to workaround an issue like this, when creating a separate folder and including the sources there gives the same result.
Beta Was this translation helpful? Give feedback.
All reactions