【发布时间】:2021-11-07 18:02:57
【问题描述】:
使用 VS 2022 RC3 和 SDK 6.0.0-rc.2.21501.6
项目文件已经喜欢了
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>WinExe</OutputType>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>
Microsoft.WindowsDesktop.App.WPF框架被正确引用,版本6.0.0-rc.2.21501.6
当我尝试构建项目时,我得到一个错误
Error LC0000 'Could not load file or assembly 'PresentationFramework,
Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. Reference assemblies should not be loaded for execution. They can only
be loaded in the Reflection-only loader context. (Exception from HRESULT:
0x80131058)' filename filePathHere LC 1
【问题讨论】:
-
该包已与主 .NET 包合并,请查看文档:docs.microsoft.com/en-us/dotnet/core/compatibility/sdk/5.0/…
-
您可以尝试使用以下工具来迁移您的代码:github.com/dotnet/try-convert。请记住,.NET 5 是跨平台的,而 .NET 4.8 不是,它们是不同的野兽
-
<UseWPF>true</UseWPF>丢失。 -
@HansPassant 我的错,它在里面 - 更新的问题。
标签: c# .net-6.0 visual-studio-2022