bytecodealliance / componentize-dotnet

Tooling for creating WebAssembly components from C#
Apache License 2.0
40 stars 9 forks source link

Fix componentize-dotnet for Linux #55

Open jsturtevant opened 1 week ago

jsturtevant commented 1 week ago

Currently the package only pulls in the Windows version of the runtime packages:

runtime.win-x64.Microsoft.DotNet.ILCompiler.LLVM 

It should do this for the version that it is running against. #54 is trying to solve that issue

Workaround

The work around is is to add the package then run:

dotnet add runtime.linux-x64.Microsoft.DotNet.ILCompiler.LLVM 
SingleAccretion commented 1 week ago

As far as I am aware, there is no NuGet mechanism to pull in a RID-specific package based on the host (SDK's) RID.

(There is an undocumented mechanism for doing so with target RIDs.)

I think the simplest way forward here is to make the SDK package itself RID-specific, i. e. publish:

BytecodeAlliance.Componentize.DotNet.Wasm.SDK.linux-x64
BytecodeAlliance.Componentize.DotNet.Wasm.SDK.win-x64
...

With the consumption side being:

<PackageReference Include="BytecodeAlliance.Componentize.DotNet.Wasm.SDK.$(NETCoreSdkPortableRuntimeIdentifier)" />

Then adding dependencies on anything host-RID-specific becomes very simple.

The alternative to this is manually downloading and caching the host-specific content.