Visual Studio无法创建或打开WinUI 3项目的问题求助
WinUI 3项目创建与打开失败问题求助
问题现象
- 打开WinUI 3项目时,报错提示:找不到指定的SDK 'Microsoft.NET.Sdk'
- 尝试创建新的WinUI 3项目时,抛出异常:
Exception of type 'System.Exception' was thrown.(附异常截图)
注:待打开的项目仓库来自另一台电脑,从未切换过.NET SDK版本。
已尝试的解决操作
- 重新安装并修复Visual Studio
- 重新安装.NET 6 SDK
项目.csproj文件内容
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>WinExe</OutputType> <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion> <RootNamespace>Clankboard</RootNamespace> <ApplicationManifest>app.manifest</ApplicationManifest> <Platforms>x86;x64;ARM64</Platforms> <RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers> <PublishProfile>win10-$(Platform).pubxml</PublishProfile> <UseWinUI>true</UseWinUI> <EnableMsixTooling>true</EnableMsixTooling> <PlatformTarget>x64</PlatformTarget> </PropertyGroup> <ItemGroup> <None Remove="ShellPage.xaml" /> <None Remove="SoundboardPage.xaml" /> </ItemGroup> <ItemGroup> <Content Include="Assets\SplashScreen.scale-200.png" /> <Content Include="Assets\LockScreenLogo.scale-200.png" /> <Content Include="Assets\Square150x150Logo.scale-200.png" /> <Content Include="Assets\Square44x44Logo.scale-200.png" /> <Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" /> <Content Include="Assets\StoreLogo.png" /> <Content Include="Assets\Wide310x150Logo.scale-200.png" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.3.230602002" /> <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" /> <Manifest Include="$(ApplicationManifest)" /> </ItemGroup> <!-- Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging Tools extension to be activated for this project even if the Windows App SDK Nuget package has not yet been restored. --> <ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'"> <ProjectCapability Include="Msix" /> </ItemGroup> <ItemGroup> <Page Update="SoundboardPage.xaml"> <Generator>MSBuild:Compile</Generator> </Page> </ItemGroup> <ItemGroup> <Page Update="ShellPage.xaml"> <Generator>MSBuild:Compile</Generator> </Page> </ItemGroup> <!-- Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution Explorer "Package and Publish" context menu entry to be enabled for this project even if the Windows App SDK Nuget package has not yet been restored. --> <PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'"> <HasPackageAndPublishMenu>true</HasPackageAndPublishMenu> </PropertyGroup> </Project>
内容的提问来源于stack exchange,提问作者Davide_24
相关产品推荐
相关产品推荐

