main.js 626 B

1234567891011121314151617
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. import { dotnet } from './dotnet.js' // NET 7
  4. //import { dotnet } from './_framework/dotnet.js' // NET 8+
  5. const is_browser = typeof window != "undefined";
  6. if (!is_browser) throw new Error(`Expected to be running in a browser`);
  7. const dotnetRuntime = await dotnet
  8. .withDiagnosticTracing(false)
  9. .withApplicationArgumentsFromQuery()
  10. .create();
  11. const config = dotnetRuntime.getConfig();
  12. await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [globalThis.location.href]);