frosty7350
frosty7350
CC#
Created by frosty7350 on 3/31/2023 in #help
❔ ✅ Native dependencies from razor class library to a wasm app project.
So if a have a blazor wasm application and I use native dependencies like so https://learn.microsoft.com/en-us/aspnet/core/blazor/webassembly-native-dependencies?view=aspnetcore-7.0. The wasm build tools builds my .c files for wasm and I can use it with blazor components as expected. However, if I want to move my razor components that use the native dependencies to a separate class library I currently still need to keep the .c file in the blazor wasm application project. So basically my issue is that I need to define the native file reference and keep the .c file in the client application itself.
<PropertyGroup>
<EmccLinkOptimizationFlag>-s USE_WEBGL2=1 -s MAX_WEBGL_VERSION=3</EmccLinkOptimizationFlag>
</PropertyGroup>
<ItemGroup>
<NativeFileReference Include="WebGL2.c" />
</ItemGroup>
<PropertyGroup>
<EmccLinkOptimizationFlag>-s USE_WEBGL2=1 -s MAX_WEBGL_VERSION=3</EmccLinkOptimizationFlag>
</PropertyGroup>
<ItemGroup>
<NativeFileReference Include="WebGL2.c" />
</ItemGroup>
So how could I avoid needing to define the above + having the .c file inside the application project itself when using the class library? Do I need to create a nuget to include the class library in the simplest way possible in other projects?
7 replies