RazorGenerator icon indicating copy to clipboard operation
RazorGenerator copied to clipboard

Multiple projects with PrecompiledMvcEngine?

Open migig opened this issue 9 years ago • 4 comments

Shared views are in a separate "library" MVC project. The WebActivatorEx.PostApplicationStartMethod is used to register the view engine.

But I also precompile views in my main MVC project. And so it also needs to register its views using WebActivatorEx.PostApplicationStartMethod.

So now, I have the PrecompiledMvcEngine registered twice.

Seems like its working, but I'm wondering if this is a good idea... am I doing it right? Can this lead to a race condition depending on which one is registered first? Can I somehow register it once for both assemblies?

migig avatar May 03 '15 10:05 migig

Take a look at CompositePrecompiledMvcEngine. e.g. see here.

davidebbo avatar May 03 '15 22:05 davidebbo

Not much/any documentation for it unfortunately...So:

I don't understand the use case for it? Is it for the case where you want to have multiple assemblies register views, or, when one assembly "overrides" views from another assembly? Or both?

migig avatar May 11 '15 16:05 migig

There is any samples or documentation provided for CompositePrecompiledMvcEngine I see adding one library works perfectly but adding two compiled view libraries at a time is an issue.

I prepared some sample to demonstrate my issue. if i am referencing the projects ClassLib_PreCompiledVies & Web_PreCompiled to the WebApp_Test.

Test Project: https://github.com/vyelchuri/PrecompiledViewsTest

image

How to register both assemblies with out any issue ?

vyelchuri avatar Mar 02 '17 14:03 vyelchuri

Maybe just missing a binding redirect?

davidebbo avatar Mar 02 '17 16:03 davidebbo