桌面应用程序中的 .NET Core MVC 视图组件:Component.InvokeAsync 找不到视图
.NET Core MVC view components in desktop app: Component.InvokeAsync can't find view
我在 ASP.NET Core 中建立了一个网站,并且运行良好。
现在我正尝试按照 here.
的说明在 Windows Chromium 桌面应用程序中启动我的 ASP.NET 核心 Web 应用程序
我运行app MyMvcApp.dll
。应用启动,但尝试加载视图组件 (ProgressViewComponent
) 的视图,并抛出错误:
InvalidOperationException: The view 'Components/Progress/Default' was not found. The following locations were searched:
/Views/RawDataFileCopy/Components/Progress/Default.cshtml
/Views/Shared/Components/Progress/Default.cshtml
/Pages/Shared/Components/Progress/Default.cshtml
失败的行:
@await Component.InvokeAsync("Progress", new { processId = Model.ProcessId, processName = Model.ProcessName })
在 Visual Studio 中,在我的 ASP.NET 核心项目中,我的文件位于:
Views/Shared/Components/Progress/Default.cshtml
当我在浏览器中 运行 Web 应用程序时,这工作正常。
有趣的是,我注意到编译器创建了 MyMvcApp.Views.dll
,但如果我反编译它,我实际上看不到 Progress/Default
视图,所以问题可能在于它没有编译正确查看?
如有任何想法,我们将不胜感激。
视图上的构建操作未设置为 Content。我将其更改为 Content,它起作用了。
我在 ASP.NET Core 中建立了一个网站,并且运行良好。
现在我正尝试按照 here.
的说明在 Windows Chromium 桌面应用程序中启动我的 ASP.NET 核心 Web 应用程序我运行app MyMvcApp.dll
。应用启动,但尝试加载视图组件 (ProgressViewComponent
) 的视图,并抛出错误:
InvalidOperationException: The view 'Components/Progress/Default' was not found. The following locations were searched: /Views/RawDataFileCopy/Components/Progress/Default.cshtml /Views/Shared/Components/Progress/Default.cshtml /Pages/Shared/Components/Progress/Default.cshtml
失败的行:
@await Component.InvokeAsync("Progress", new { processId = Model.ProcessId, processName = Model.ProcessName })
在 Visual Studio 中,在我的 ASP.NET 核心项目中,我的文件位于:
Views/Shared/Components/Progress/Default.cshtml
当我在浏览器中 运行 Web 应用程序时,这工作正常。
有趣的是,我注意到编译器创建了 MyMvcApp.Views.dll
,但如果我反编译它,我实际上看不到 Progress/Default
视图,所以问题可能在于它没有编译正确查看?
如有任何想法,我们将不胜感激。
视图上的构建操作未设置为 Content。我将其更改为 Content,它起作用了。