You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Visual Studio 17.6预览版无法打开MAUI项目设置的解决办法咨询

问题:VS 17.6 Preview 6中打开MAUI项目属性时触发AndroidPackageFormat参数错误

环境信息

Microsoft Visual Studio Community 2022
Version 17.6.0 Preview 6.0
VisualStudio.17.Preview/17.6.0-pre.6.0+33626.354
Microsoft .NET Framework
Version 4.8.09032

Installed Version: Community

Visual C++ 2022   00482-90000-00000-AA489
Microsoft Visual C++ 2022

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools   17.6.323.41838
ASP.NET and Web Tools

Azure App Service Tools v3.0.0   17.6.323.41838
Azure App Service Tools v3.0.0

Azure Data Lake Tools for Visual Studio   2.6.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   17.6.323.41838
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.5000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   4.6.0-3.23212.2+d78a163b525fd73efb768f4f0095590f9ade3469
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus   1.4.21 (main@8f226a8)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Microsoft Azure Hive Query Language Service   2.6.5000.0
Language service for Hive query

Microsoft Azure Stream Analytics Language Service   2.6.5000.0
Language service for Azure Stream Analytics

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Mono Debugging for Visual Studio   17.6.41 (790a401)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.5.50201.1 Commit Hash:0a76e2b03608f2fdee0e7d2e38e83d7721149b5f
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   6.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Razor (ASP.NET Core)   17.6.0.2317807+3be43f6abbdc8d585f17c168f03b18420aab1062
Provides languages services for ASP.NET Core Razor.

SonarLint for Visual Studio   6.15.0.67199
SonarLint is an extension to your favorite IDE that provides on-the-fly feedback to developers on new bugs and quality issues injected into their code.

SQL Server Data Tools   17.6.6.2
Microsoft SQL Server Data Tools

SQLite & SQL Server Compact Toolbox   4.8
SQLite & SQL Server Compact Toolbox adds scripting, import, export, rename, query execution and much more to SQL Server Compact & SQLite Data Connections.

StylerPackage Extension   1.0
StylerPackage Visual Stuido Extension Detailed Info

Syncfusion .NET MAUI Template Studio   21.1.35
Provides project templates for creating an .NET MAUI Application using Syncfusion Maui components.

Syncfusion ASP.NET Core Project Templates   21.1.35
Provides project templates for creating an ASP.NET Core Web Application using Syncfusion ASP.NET Core components.

Syncfusion Blazor Code Generator   21.1.35
Insert Syncfusion components code snippet in the existing razor file of Blazor application

Syncfusion Blazor Template Studio   21.1.35
Provides project templates for creating an Blazor Application using Syncfusion Blazor components.

Syncfusion EJ2 Web Conversion and Migration   21.1.35
Converts and migrates a web project into a Syncfusion web project.

SyncfusionMenu Extension   21.1.35
SyncfusionMenu Visual Studio Extension Detailed Info

Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   17.0.20329.2001
TypeScript Tools for Microsoft Visual Studio

UnoPlatformPackage Extension   1.0
UnoPlatformPackage Visual Studio Extension Detailed Info

Visual Basic Tools   4.6.0-3.23212.2+d78a163b525fd73efb768f4f0095590f9ade3469
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   17.6.0-beta.23174.5+0207bea1afae48d9351ac26fb51afc8260de0a97
Microsoft Visual F# Tools

Visual Studio IntelliCode   2.2
AI-assisted development for Visual Studio.

Visual Studio Tools for Unity   17.6.1.0
Visual Studio Tools for Unity

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSPackage Extension   1.0
VSPackage Visual Studio Extension Detailed Info

Xamarin   17.6.0.251 (d17-6@318364c)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   17.6.6.0 (remotes/origin/d17-6@cb430751d1)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   17.6.32 (98c12a2)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   13.2.0.6 (d17-5/a200af1)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 6dd9def
    Java.Interop: xamarin/java.interop/d17-5@149d70fe
    SQLite: xamarin/sqlite/3.40.1@68c69d8
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@9f02d77


Xamarin.iOS and Xamarin.Mac SDK   16.4.0.6 (97731c92c)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

问题详情

为使用.NET MAUI 8.0.100-preview.3.23178.7中的专属修复内容,升级至VS 17.6 Preview 6后,打开MAUI项目属性时触发以下错误:

System.ArgumentException: Expected 8 values for property AndroidRule::AndroidPackageFormat, but got 2.
Parameter name: values
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.Property.Update(ImmutableArray`1 values)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.Property..ctor(PropertyMetadata metadata, ImmutableArray`1 values, PropertyContext context, ImmutableHashSet`1 varyByDimensions)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.PropertyContextFactoryBase.ToProperty(IUIPropertySnapshot property, Page page, Category category, Int32 order, PropertyContext propertyContext, IPropertyEditorRegistry propertyEditorRegistry)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertyDataAccess.Observer.<HandleDataAsync>g__CreateProperties|14_5(<null> c__DisplayClass14_0& )
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertyDataAccess.Observer.<HandleDataAsync>g__ProcessInitialData|14_1(<null> c__DisplayClass14_0& )
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertyDataAccess.Observer.<InitializeAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertyDataAccess.Observer.<CreateAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertiesEditor.<>c__DisplayClass0_0.<<-ctor>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.AsyncLoadContent.<>c__DisplayClass0_0.<<Initialize>b__0>d.MoveNext()

属性错误

无需回退至稳定版的解决办法

1. 手动编辑项目文件

  • 关闭Visual Studio,找到MAUI项目的.csproj文件,用文本编辑器打开
  • 查找是否存在<AndroidPackageFormat>节点,若存在则直接删除该节点(让系统使用默认配置);若节点值格式异常,修正为符合要求的格式(如apk或aab)
  • 保存文件后重新打开项目,尝试访问属性页

2. 同步MAUI NuGet包版本

  • 打开NuGet包管理器,确保所有Microsoft.Maui.*相关包的版本与使用的.NET MAUI SDK(8.0.100-preview.3.23178.7)完全一致
  • 执行Build -> Clean Solution清理项目,再执行Build -> Rebuild Solution重建项目

3. 清除Visual Studio缓存

  • 关闭VS,删除以下目录的缓存文件:
    • %LOCALAPPDATA%\Microsoft\VisualStudio\17.0_<你的预览版标识>\ComponentModelCache
    • %USERPROFILE%\AppData\Local\Temp\VisualStudioBuildExtensions
  • 重新启动VS,打开项目测试

4. 更新Android SDK组件

  • 打开VS的Android SDK管理器,安装与.NET MAUI 8预览版兼容的最新Android SDK平台及工具
  • 确保Xamarin.Android SDK版本与当前VS预览版适配,必要时更新至预览版Xamarin.Android组件

内容的提问来源于stack exchange,提问作者adamasan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 15:07:01