Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.mjs: main.dotnet is undefined #158

Closed
Dexus opened this issue Sep 2, 2024 · 3 comments
Closed

index.mjs: main.dotnet is undefined #158

Dexus opened this issue Sep 2, 2024 · 3 comments

Comments

@Dexus
Copy link

Dexus commented Sep 2, 2024

const runtime = await options?.create?.(config) || await main.dotnet.withConfig(config).create();

Uncaught TypeError: Cannot read properties of undefined (reading 'Module')
    at Object.boot (index.mjs:252:13)
    at async (Index):17:1

What did I do wrong?

This fails:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
        <!-- Not embedding binaries to source module reduces build size by ~30%. -->
        <BootsharpEmbedBinaries>false</BootsharpEmbedBinaries>
        <!-- Disabling non-essential .NET features reduces minimal build size by ~35%. -->
        <BootsharpAggressiveTrimming>true</BootsharpAggressiveTrimming>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Bootsharp" Version="0.3.2" />
    </ItemGroup>
</Project>

It looks like there are never created requests for the files in the bin path....

This works - no bin path and included in the index.mjs:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
        <!-- Not embedding binaries to source module reduces build size by ~30%. -->
        <BootsharpEmbedBinaries>true</BootsharpEmbedBinaries>
        <!-- Disabling non-essential .NET features reduces minimal build size by ~35%. -->
        <BootsharpAggressiveTrimming>true</BootsharpAggressiveTrimming>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Bootsharp" Version="0.3.2" />
    </ItemGroup>
</Project>
@elringus
Copy link
Owner

elringus commented Sep 2, 2024

Probably missing some init steps; see the trimming sample for a reference on how to init w/o embedding the bins: https://github.com/elringus/bootsharp/blob/main/samples/trimming/main.mjs

@Dexus
Copy link
Author

Dexus commented Sep 2, 2024

ok, got this now running, but now I can't resolve the Assemblies:

Schweregrad	Code	Beschreibung	Projekt	Datei	Zeile	Unterdrückungszustand	Details
Fehler (aktiv)	MSB4062	Die Bootsharp.Publish.BootsharpPack-Aufgabe konnte nicht aus der C:\Users\dexus\.nuget\packages\bootsharp\0.3.2\build\..//tasks/Bootsharp.Publish.dll-Assembly geladen werden. Die Datei oder Assembly "System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden. Stellen Sie sicher, dass die <UsingTask>-Deklaration korrekt ist, die Assembly und alle zugehörigen Abhängigkeiten verfügbar sind und die Aufgabe eine öffentliche Klasse enthält, die Microsoft.Build.Framework.ITask implementiert.	GAME.WASM	C:\Users\dexus\.nuget\packages\bootsharp\0.3.2\build\Bootsharp.targets	112		

Does it make sense, that the System.Runtime is newer, and therefor cant be found?

@elringus
Copy link
Owner

elringus commented Sep 2, 2024

If you're using visual studio, check this #137

@Dexus Dexus closed this as completed Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants