You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
When I start project from ConsoleApp1, embedded views not working, throws exception:
fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[0]
An unhandled exception has occurred: One or more compilation failures occurred:
jm5mnrtm.ru3(10,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
jm5mnrtm.ru3(11,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
jm5mnrtm.ru3(12,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
jm5mnrtm.ru3(15,36): error CS0234: The type or namespace name 'ViewFeatures' does not exist in the namespace 'Microsoft.AspNetCore.Mvc' (are you missing an assembly reference?)
jm5mnrtm.ru3(16,11): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
jm5mnrtm.ru3(18,86): error CS1980: Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference?
When I start from App1 (after converted to Console App) its working.
The text was updated successfully, but these errors were encountered:
I'm guessing this is the same/similar issue as #6021.
I think the problem is that because view pre-compilation is turned on by default for web projects, the reference assemblies that would be needed by Razor to compile the embedded views are not included anymore, so all runtime compilation will fail.
@oguzhaneren Mvc looks for the deps file that matches the application name - in your case App1.deps.json to locate references to compile views with. However, nothing places it in the output directory of the executing application viz. ConsoleApp1. Explicitly copying the file fixes the compilation. Here's one way to go about it:
In that repo https://github.com/oguzhaneren/birsey, I created 3 projects:
App1 - Aspnet core class library
ClassLibrary1 - dotnet core class library (includes views)
ConsoleApp1 - dotnet core console application (hosting App1)
When I start project from ConsoleApp1, embedded views not working, throws exception:
When I start from App1 (after converted to Console App) its working.
The text was updated successfully, but these errors were encountered: