首页 > 解决方案 > 来自 System.Private.CoreLib 的 WASM WebAssembly FileNotFoundException

问题描述

我正在尝试使用https://platform.uno/来构建一些工具。由于某些基本 Microsoft 库的 FileNotFoundExceptions,来自 uno-platform 模板的 WASM (WebAssembly)-Project 将无法启动。我从 uno 模板创建了一个新的 uno 平台 APP。我已将所有 NuGet 包更新到最新版本。当我启动 wasm 网络项目时,我得到以下异常(我猜是在引导程序中):

FileNotFoundException

其次是: FileNotFoundException

其次是: 世界跆拳道联盟

在这里你可以看到 Exception 类来自图 1 中没有找到的命名空间。这对我来说很奇怪,我不知道是怎么回事了。我想这是某个地方的依赖项中的先决条件或错误版本的问题。有人知道怎么回事吗?

这是 WASM 项目的 csproj:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netstandard2.0</TargetFramework>
    <WasmHead>true</WasmHead>
    <DefineConstants>$(DefineConstants);__WASM__</DefineConstants>
    <NoWarn>NU1701</NoWarn>
    <StartupObject>Macs3.Calculations.TestTool.Wasm.Program</StartupObject>
	<MonoRuntimeDebuggerEnabled>true</MonoRuntimeDebuggerEnabled> 
  </PropertyGroup>
  <ItemGroup>
    <Content Include="..\Macs3.Calculations.TestTool.UWP\Assets\*.png" Link="Assets\%(FileName)%(Extension)" />
    <Content Include="Fonts\winjs-symbols.woff2" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="WasmCSS\Fonts.css" />
    <EmbeddedResource Include="WasmScripts\AppManifest.js" />
  </ItemGroup>
  <ItemGroup>
    <LinkerDescriptor Include="LinkerConfig.xml" />
  </ItemGroup>
  <ItemGroup>
    <!-- 
    This item group is required by the project templace because of the
    new SDK-Style project, otherwise some files are not aded automatically.
    
    You can safely remove this ItemGroup completely.
    -->
    <Compile Remove="Program.cs" />
    <Compile Include="Program.cs" />
    <Content Include="LinkerConfig.xml" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Uno.UI" Version="1.46.0-dev.2039" />
    <PackageReference Include="Uno.Wasm.Bootstrap" Version="1.0.0-dev.298" />
  </ItemGroup>
  <Import Project="..\Macs3.Calculations.TestTool.Shared\Macs3.Calculations.TestTool.Shared.projitems" Label="Shared" Condition="Exists('..\Macs3.Calculations.TestTool.Shared\Macs3.Calculations.TestTool.Shared.projitems')" />
</Project>

标签: .net-core.net-standarduno-platform

解决方案


推荐阅读