c# - DotNetCore3.0 WPF - error - Project file is incomplete. Expected imports are missing
问题描述
I've created a WPF application using VisualStudio 2017
by selecting the .Net framework 4.6
. Know I'm trying to configure it for .Net Core 3.0 for WPF. But unfortunately, after changing my configuration, When reloading my projects, I got this error.
Project file is incomplete. Expected imports are missing.
I've checked all the reference files are there.
Here is my .csproj
file.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>HelloWorld</AssemblyName>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<ApplicationDefinition Include="..\WpfApp\App.xaml" Link="App.xaml" />
<Compile Include="..\WpfApp\App.xaml.cs" Link="App.xaml.cs" />
</ItemGroup>
<ItemGroup>
<Page Include="..\WpfApp\MainWindow.xaml" Link="MainWindow.xaml" />
<Compile Include="..\WpfApp\MainWindow.xaml.cs" Link="MainWindow.xaml.cs" />
</ItemGroup>
</Project>
I've installed this SDK version 3.0.100-preview5-011568
. I've also enabled the Use previews of .Net Core SDK in VisualStudio.
解决方案
You should upgrade to Visual Studio 2019. It includes a project template for WPF and Windows Forms applications targeting .NET Core 3.
From the docs:
Visual Studio 2017 doesn't support .NET Core 3.0 projects.
推荐阅读
- matlab - matlab分层交叉验证分区中的错误“CVPARTITION最多可以有一个可选参数”
- javascript - 如何创建一个 html 表格来显示具有不同字段的对象数组?
- json - Powershell 脚本 - Azure sql db - json 文件
- c# - 如何根据组 ID 从另一个模型中过滤我的学生列表。(.NET 核心 2.2)
- ssl - 没有为 ingress-nginx 后端配置 SSL 直通
- c# - 创建动态元组
- android - S3 将图像大小显示为 0 KB Kotlin Android
- c# - IdentityUserLogin 的实现
- sql-server - 从两个表中获取不同的值
- python - 如何在训练 XGBoost 模型时使用 GPU?