-
Notifications
You must be signed in to change notification settings - Fork 16
View compilation fails when cross-compiling for Linux on Windows #102
Comments
Here's my hacky workaround: Build first for Windows, then build for Linux with view precompilation disabled, then copy across the PrecompiledViews assembly:
|
None of the toolchain natively supports mono anymore. You'll hit edges like this all over the stack. The "fix here" is to have the driver invoke mono {exe} when running on Linux and targeting net4x |
@davidfowl - I'm not running the tools on Mono, I'm only running the published website on Mono (which works fine). I'm running those |
Includes workaround for aspnet/MvcPrecompilation#102
Just want to add that this also occurs when trying to publish for windows on osx. And to clarify, Mono is not involved at all, target is netcoreapp1.1 |
To expand a bit on what @simsod said. We are building this on OSX to be deployed on a Windows server.
If test it out on a Windows 10 machine the opposite things work (ie win7-x64 compiles fine and osx.10.11-x64 fails with a similar error). If I disable viewcompilation everything is fine on both environments. This worked fine using the old tooling (project.json) using the same version of |
@karl-sjogren, would you mind filing a separate issue for your thing? The original issue is about trying to target desktop ( |
@simsod @karl-sjogren - The same workaround that I'm using might work for your use case too: Build for the "current" platform, then build for the destination platform with view precompilation disabled, then copy across the PrecompiledViews assembly.
It's a bit slower as it builds the site twice, I couldn't get view precompilation working without doing a full build though (running the ViewCompilation assembly directly just threw an error) |
@pranavkm Sorry, I missed that he said mono and not netcore (not sure how I missed that). The error just looked so much like ours. I'll file a separate bug tomorrow when I get in at work. |
Any news in this topic? |
Sorry, not as yet. We need to rethink some of the design for how the tool works and haven't had a chance to set up a meeting with the relevant folks as yet. We'll have this triaged for our next milestone - preview3. |
⬆️🏈⬆️ Moving to 2.1.0 because in 2.0.0 w/ runtime stores the size of apps is a lot smaller anyway. The fix is for the precompilation task to build the user's app and run it w/o the specified RID so that the code can run properly on the local machine. |
Any movement on this? I'm compiling for win10-arm to run on iOT Core Pi3 and it's pretty painful waiting for that device to compile the views at runtime |
@los93sol - we're still wrapping up 2.0.0 stuff. The work item was moved to the 2.1.0 release. For the time being, the workaround @Daniel15 has in #102 (comment) might alleviate some of your issues. |
is precompilation required for Razor pages to work, ie. is this really a required/necessary step in the tools, and also, is it necessary to double-build just to publish and test cross-platform? |
It is not necessary for development but is absolutely necessary to put something into production, otherwise your site will take several minutes for the first load. Subsequent loads are fast since the views are compiled at that point, but once your app recycles the first load will be brutally slow again. |
@wilson0x4d precompilation is never "required," but it can indeed improve runtime performance. Though, I've never seen that without precompiling an application that it would take "several minutes" for the first load. Views are compiled on-demand, so unless the first request uses thousands of views (many layout pages, partial views, view components, etc.), it should take only a few seconds to compile the first few views.... and then another few milliseconds for each additional view. The first view to be compiled has the overhead of loading the compiler, and that's typically just a few seconds. |
Microsoft.AspNetCore.Mvc.Razor.ViewCompilation
version 1.1.0csproj
to add:Expected: Publish works as expected
Actual: Error is thrown:
The text was updated successfully, but these errors were encountered: