Skip to content
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

Support "portable" (.NET Standard 2.0) tasks #2738

Closed
dsplaisted opened this issue Nov 21, 2017 · 5 comments
Closed

Support "portable" (.NET Standard 2.0) tasks #2738

dsplaisted opened this issue Nov 21, 2017 · 5 comments
Labels

Comments

@dsplaisted
Copy link
Member

Currently, MSBuild targets .NET Standard 1.3 and .NET Framework 4.6. If you want to build a task that runs on both .NET Core and full framework MSBuild, you can reference the .NET Core versions of the MSBuild libraries, which target .NET Standard 1.3. When running on full framework MSBuild, these references would bind to the full framework implementations (similar to the "bait and switch" technique).

As part of upgrading to .NET Core 2.0, the .NET Core versions of the MSBuild libraries will target .NET Standard 2.0. This means they won't load on .NET 4.6. They can load on .NET 4.6.1, but the proper .NET Standard facades need to be available.

@jaredpar
Copy link
Member

Does the world get simpler here if we change the minimum required desktop version of MSBuild to be 4.6.1?

@dsplaisted
Copy link
Member Author

I've resolved this with my latest changes. GenAPI creates source files which are used to create reference assemblies that go in the NuGet packages. The MSBuild APIs themselves are still compatible with .NET Standard 1.3, so I am compiling the reference assemblies for .NET Standard 1.3 in addition to .NET 4.6 and 2.0, and putting them all in the NuGet package.

@dsplaisted
Copy link
Member Author

It looks like this may be a problem once again. Enabling binary serialization is causing types to be used in public APIs which aren't available in .NET Standard 1.3.

@dasMulli
Copy link
Contributor

Cross-linking this with dotnet/sdk#1855 (comment)

by @ericstj

the bigger problem here is that the whole premise is busted: NETStandard libraries themselves aren't publishable/runnable since they may depend on packages with framework specific implementations and selecting at runtime between frameworks isn't something that any framework understands nor is it persisted by NuGet.

@rainersigwald
Copy link
Member

This mostly works today: if your task has no references outside of .NET Standard 2.0 itself, it'll work fine on both flavors of MSBuild.

This part remains

NETStandard libraries themselves aren't publishable/runnable since they may depend on packages with framework specific implementations

And we should still publish better guidance (#4198).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants