我正在尝试使用Visual Studio 2022(预览)创建。net 6的Blazor Webassembly应用程序。我在该项目中引用了外部程序集文件。当我构建项目时,我得到了以下错误,
资产'D:OfficeTestingBlazorApp1BlazorApp1binDebugnet6.0wwwroot_frameworkClassLibrary1.dll'无法在任何搜索位置找到'D:OfficeTestingBlazorApp1BlazorApp1binDebugnet6.0wwwroot_frameworkClassLibrary1.dll'和'ClassLibrary1'
截屏图像
有解决办法吗?
项目属性
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0-rc.1.21452.15" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0-rc.1.21452.15" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<Reference Include="ClassLibrary1">
<HintPath>LibClassLibrary1.dll</HintPath>
<EmbedInteropTypes></EmbedInteropTypes>
</Reference>
</ItemGroup>
<ItemGroup>
<ServiceWorker Include="wwwrootservice-worker.js" PublishedContent="wwwrootservice-worker.published.js" />
</ItemGroup>
</Project>
你只需要改变这个,
<ItemGroup>
<Reference Include="../Lib/ClassLibrary1">
<HintPath>LibClassLibrary1.dll</HintPath>
<EmbedInteropTypes></EmbedInteropTypes>
</Reference>
</ItemGroup>