How to specify a package dependency on "any" framework using project files? #10667
Unanswered
teo-tsirpanis
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a package (let's call it A) that contains only MSBuild tasks and no reusable code. This package depends on another one (let's call it B) that imports some MSBuild target files using
buildTransitive
; allowing them to be shared by many packages.Package A's task runs on .NET Core 3.1, but the package itself can be used by projects targeting any framework like .NET Standard 2.0 or .NET Framework. The problem is that when I use Package A from a (say) .NET Standard 2.0 library, build completes successfuly but the task fails to have the desired effect because Package B was not loaded (because .NET Standard projects cannot use .NET Core 3.1 packages).
Is there a way to make Package A always depend on Package B with the
any
TFM?It certainly can be done using a custom
.nuspec
file but I would prefer not to use one because it complicates the structure and creation of the package.And targeting another framework on Package A's task assembly is out of the question; it dynamically loads assemblies using unloadable
AssemblyLoadContext
s, and porting it to .NET Framework has beet attempted more than once and turned out to be extraordinarily frustrating.Beta Was this translation helpful? Give feedback.
All reactions