jamescourtney / FlatSharp

Fast, idiomatic C# implementation of Flatbuffers
Apache License 2.0
497 stars 50 forks source link

The task factory "CodeTaskFactory" is not supported on the .NET Core version of MSBuild #273

Closed ghost closed 2 years ago

ghost commented 2 years ago

In certain environments, CodeTaskFactory appears to be unavailable, which is a dependency of the Inline Task that was added to the Targets File in 6.1.0. (by me, sorry!)

A better cross-platform choice (which instead targets .NET Standard) looks to be to use RoslynCodeTaskFactory instead.

This is only available in MSBuild 15.8 and newer, but we can revert back to using CodeTaskFactory for earlier versions as described under Provide backward compatibility.

I will raise a PR for this fix shortly.

jamescourtney commented 2 years ago

How widely is CodeTaskFactory supported? I'm wondering if we should bit the bullet and just include an MSBuild Task in a DLL. That seems like it might work better for older versions of .NET (framework, etc).

I'll research this a little bit tonight. Thanks again for raising this a proposing a fix!

ghost commented 2 years ago

It's a good question. I obviously made the incorrect assumption that it was more widely supported than it appears to be!

You're probably right, it would likely be a more robust option to precompile an MSBuild Task an include that in a DLL... despite my best efforts to avoid that :)

Let me know what you find. I'd be happy to implement this alternative as well if you'd prefer, as this was my bug in the first place!

jamescourtney commented 2 years ago

Based on what I've read, CodeTaskFactory was introduced in either VS2013 or VS2015. That meets my bar for calling it supported, so I'll approve your PR. Thanks for your diligence on this!

jamescourtney commented 2 years ago

Can we mark this as closed @yak-shaver ?