Skip to content

Roslyn based csc.exe and aspnet_compiler.exe replacement with metaprogramming hooks for ASP.NET MVC projects from the pre-DNX era

License

Notifications You must be signed in to change notification settings

mirandaasm/StackExchange.Precompilation

 
 

Repository files navigation

StackExchange.Precompilation

Replacing csc.exe

  • Install-Package StackExchange.Precompilation.Build -Pre

Replacing aspnet_compiler.exe for .cshtml precompilation

  • Install-Package StackExchange.Precompilation.Build -Pre
  • Add <PropertyGroup><SEPrecompilerIncludeRazor>true</SEPrecompilerIncludeRazor></PropertyGroup> to your .csproj file (usually replacing the MvcBuildViews property)

Using precompiled views

Using C# 6 in ASP.NET MVC 5

Meta-programming

  • Create a new project
  • Install-Package StackExchange.Precompilation.Metaprogramming -Pre
  • Implement the ICompileModule interface
  • Install-Package StackExchange.Precompilation.Build -Pre in the target project
  • Configure your new module in the target project's web.config or app.config

Development

if you have an existing project with StackExchange.Precompilation packages and encounter a bug you can simply:

  • pull this repo
  • increment semver.txt
  • make the fix in the source code
  • run BuildAndPack.ps1 (requires a console with VS env vars in your PATH, I recommend powershell with Posh-VsVars)
  • setup a nuget source pointing at .\packages\obj
  • after that you can update the packages StackExchange.Precompilation in your target project from the packages\obj source
  • this gives you local *-alpha{timestamp} suffixed packages instead of the *-beta{build} ones produced by the CI build
  • PROTIP: if you want to attach an debugger to the compilation of your project or any of the Test.* projects, add a System.Diagnostics.Debugger.Launch() statement somewhere in the code ;)

About

Roslyn based csc.exe and aspnet_compiler.exe replacement with metaprogramming hooks for ASP.NET MVC projects from the pre-DNX era

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 98.8%
  • PowerShell 1.1%
  • Other 0.1%