EDIT: As a colleague pointed out, the method below could potentially cause errors at runtime if the .NET Core 2.1 runtime is not installed.
The recently announced .NET Core 2.1 brings some nice new features, but the big draw is the support of Span
There’s a slight catch though. .NET Core 2.1 projects can’t be referenced by UWP and .NET Framework projects, so if you have a desktop application in need of a (potential) performance boost to, it’s not as easy as it could be.
That’s a bummer.
For those who really want to use Span
One is to wrap up the .NET Core project as a Nuget package, however the development feedback loop is quite steep. If the project is standalone, this could be a suitable solution, but not so much if the project is just logically separated.
The most suitable solution investigated was to directly reference the .dll (instead of the project itself), although requiring a bit more setup than usual. Referencing the .dll doesn’t build the project it comes from, so if changes aren’t reflected until the project is manually rebuilt.
This can be alleviated by setting the Core project as a dependency of the non-core project, causing it to be built prior.
Right click Solution –> Properties
The caveat here is that the configuration doesn’t adapt to the configuration. There is apparently a way of conditionally referencing different dlls to fit configurations, however this might be excessive for most use cases.
This is only required as long as the tooling doesn’t support these combinations, however this method should continue to work for the cutting edge versions.
Enjoy the new toys!