简体   繁体   English

在asp.net core 3中使用SpaStaticFiles()查看嵌入式资源

[英]UseSpaStaticFiles() in asp.net core 3 looking inside embedded resources

I have a basic systray app that records business notes.我有一个记录业务笔记的基本系统托盘应用程序。 I'm creating an asp.net core SPA in another assembly to read those notes and display it inside a browser.我正在另一个程序集中创建一个 asp.net 核心 SPA 来读取这些注释并将其显示在浏览器中。 I added the "frontend" web assembly as a dependency of the systray app but to use correctly the spa site I need to have the static files folder inside my app folder.我添加了“前端”Web 程序集作为系统托盘应用程序的依赖项,但要正确使用 spa 站点,我需要在我的应用程序文件夹中包含静态文件文件夹。 I want to embed all static files inside the .net core web dll and instruct the engine to read files from there.我想将所有静态文件嵌入到 .net core web dll 中,并指示引擎从那里读取文件。

What's the correct way to do that?这样做的正确方法是什么?

I have changed .csproj file adding a new property我已经更改了 .csproj 文件,添加了一个新属性

<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>

then I have added然后我添加了

  <ItemGroup>
    <EmbeddedResource Include="clientapp/dist/**" />
  </ItemGroup>

and with the nuget package Microsoft.Extensions.FileProviders.Embedded I have completed the changes.使用 nuget 包 Microsoft.Extensions.FileProviders.Embedded 我已经完成了更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM