StackExchange.Precompilation icon indicating copy to clipboard operation
StackExchange.Precompilation copied to clipboard

Doesn't work with .NET Standard project

Open MihaMarkic opened this issue 7 years ago • 4 comments

Tried installing from NuGet on a .NET Standard but it wouldn't install (some packages incompatible with .NET Standard it says). Is this by design?

MihaMarkic avatar Apr 24 '17 06:04 MihaMarkic

That's because we have a hard dependency on MVC 5 (which is where the actual precompilation name comes from), and it only exists for .NET desktop. Does it fail if you only target net462? e.g.:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>net462</TargetFrameworks>
  </PropertyGroup>
</Project>

In order to fully support netstandard, we'd have to pull out the MVC 5 parts into a separate package.

To make it work with MVC 6 / vnext / core / standard, all the razor view handling code (CodeDOM -> strings, view engines, etc) would have to be re-implemented.

This will happen if we decide to start moving Stack Overflow to the new MVC version.

m0sa avatar Apr 24 '17 07:04 m0sa

Ah, OK. I have a feeling it'd be a great tool for AOP on .NET Standard. Luckily Fody is starting to support it.

MihaMarkic avatar Apr 24 '17 07:04 MihaMarkic

@m0sa I started trying to get this to work with the razor view engine for NancyFX so abstracting out the mvc parts is of interest to me. Would sure save having to fork the project. I have a roslyn version of the view engine now which runs fine, but I'm getting build errors when the precompilation runs, even with targeting .net 4.6.2.

xt0rted avatar May 15 '17 07:05 xt0rted

As of de2ede41aef7b7faa61f257878acbe83881e1d8a / v5.0.0-alpha367 the MVC5 bits have been moved out, and the the precompiler is now self contained and able to cross-compile (the csc.exe replacement is still compiled against net462 since most of the stuff I need is only available in the Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll).

image

m0sa avatar Apr 06 '18 16:04 m0sa