报错
PS F:\xx\xxxx> flutter run -d windows
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching lib\main.dart on Windows in debug mode...
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: ���setlocal [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: C:\Windows\System32\nuget.exe install Microsoft.Windows.ImplementationLibrary -Version 1.0.220914.1 -ExcludeVersion -OutputDirectory F:/xx/xxxx/build/windows/x64/packages [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: C:\Windows\System32\nuget.exe install Microsoft.Web.WebView2 -Version 1.0.1210.39 -ExcludeVersion -OutputDirectory F:/xx/xxxx/build/windows/x64/packages [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmEnd [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmErrorLevel [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: exit /b %1 [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :cmDone [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
E:\Some software\Visual Studio\VS 2022\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(156,5): error MSB3073: :VCEnd�����˳�������Ϊ 1�� [F:\xx\xxxx\build\windows\x64\plugins\webview_windows\webview_windows_DEPENDENCIES_DOWNLOAD.vcxproj]
解决方法
在 Windows 上运行 Flutter 应用时遇到了 MSB3073 错误。这个错误通常与 NuGet 包的安装问题有关
错误信息表明 NuGet 无法成功安装所需的包,导致构建失败
1、使用vs打开项目
2、点击 工具 -> NuGet 包管理器 -> 程序包管理器设置
3、在常规中,将以下选项设置成图中所示
4、添加程序包源
https://www.nuget.org/api/v2/
名字可以随便取
5、点击确定,关闭vs
6、重新打开vs,工具 -> NuGet 包管理器 -> 程序包管理器设置 ,清除存储
7、删除图中框出的两项
8、运行命令
flutter pub get --no-example
flutter run -d windows
完结,撒花~