You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Argument cannot be null or empty 参数名: primarySources CMake Error at flutter/ephemeral/.plugin_symlinks/permission_handler_windows/windows/CMakeLists.txt:29 (message): Failed to install nuget package Microsoft.Windows.CppWinRT.2.0.210806.1 #1025
Argument cannot be null or empty
参数名: primarySources
CMake Error at flutter/ephemeral/.plugin_symlinks/permission_handler_windows/windows/CMakeLists.txt:29 (message):
Failed to install nuget package Microsoft.Windows.CppWinRT.2.0.210806.1
nice.I resolved this issue after reinstall windows SDK 11(10.0.22621.0) and delete the build folder in flutter project.
Download the nuget.exe and Microsoft.Windows.CppWinRT nupkg, let them in the Flutter SDK folder(eg. D:\flutter\bin)
Run the command in the terminal in the current folder
"./nuget install Microsoft.Windows.CppWinRT -Version 2.0.210806.1"
nice.I resolved this issue after reinstall windows SDK 11(10.0.22621.0) and delete the build folder in flutter project. Download the nuget.exe and Microsoft.Windows.CppWinRT nupkg, let them in the Flutter SDK folder(eg. D:\flutter\bin) Run the command in the terminal in the current folder "./nuget install Microsoft.Windows.CppWinRT -Version 2.0.210806.1"
Argument cannot be null or empty 参数名: primarySources CMake Error at flutter/ephemeral/.plugin_symlinks/permission_handler_windows/windows/CMakeLists.txt:29 (message): Failed to install nuget package Microsoft.Windows.CppWinRT.2.0.210806.1
This is usually caused by an configuration error regarding NuGet package manager. The permission_handler_windows package makes use of NuGet to download the Microsoft.Windows.CppWinRT library which contains is used to generate C++ header files to access the Windows native runtime SDK, needed to communicate with the GPS hardware.
I am not really sure what causes the configuration error, however here are some steps that can be verified:
Make sure the default NuGet configuration file exists at the following path %appdata%\NuGet\NuGet.Config. If it doesn't exists create it with the following contents:
If the default NuGet.Config exists with the appropriate content, verify if you are allowed to connect to the https://api.nuget.org/v3/index.json url. Some organisations are configured behind a firewall or proxy blocking access.
Make sure Visual Studio 2022 (not Visual Studio Code) is installed correctly with the "Desktop development with C++" workload including all default options.
If this all fails please run flutter build windows -v. The -v switch will provide verbose information and will give more feedback on why NuGet wasn't able to install the Microsoft.Windows.CppWinRT library.
Reacted by justErti, Heru Handika, andrechalella and Raj Vardhan
Fixing "Argument cannot be null or empty. Parameter name: primarySources" NuGet Error in Flutter
When working with the permission_handler_windows package in Flutter, you might encounter the error:
Argument cannot be null or empty. Parameter name: primarySources
CMake Error at flutter/ephemeral/.plugin_symlinks/permission_handler_windows/windows/CMakeLists.txt:29 (message):
Failed to install NuGet package Microsoft.Windows.CppWinRT.2.0.210806.1
Root Cause
This issue usually arises due to a misconfiguration in NuGet package manager settings or network restrictions blocking access to the NuGet package source.
Resolution Steps
Follow the steps below to resolve the issue:
Step 1: Verify and Configure NuGet Config File
Check if the NuGet configuration file exists at this path: %appdata%\NuGet\NuGet.Config
Use the Run dialog (Win + R) and paste the path to locate it.
If the file doesn't exist, create it with the following content:
By following these steps, you should be able to resolve the error and successfully install the Microsoft.Windows.CppWinRT package. Feel free to share feedback or improvements in the comments section below!
Activity
shuzibanshou commentedon Apr 22, 2023
hi bro.I meet the same issue with you.THE SAME.
do you resolve it?
shuzibanshou commentedon Apr 22, 2023
nice.I resolved this issue after reinstall windows SDK 11(10.0.22621.0) and delete the build folder in flutter project.
Download the nuget.exe and Microsoft.Windows.CppWinRT nupkg, let them in the Flutter SDK folder(eg. D:\flutter\bin)
Run the command in the terminal in the current folder
"./nuget install Microsoft.Windows.CppWinRT -Version 2.0.210806.1"
sneurlax commentedon Jun 6, 2023
This worked for me, except I had to install the Windows 10 SDK. Then I downloaded the package ("Download package"), placed it in my Flutter's bin folder with a nuget.exe found elsewhere on my system (or from https://dist.nuget.org/win-x86-commandline/latest/nuget.exe), and used
nuget install Microsoft.Windows.CppWinRT -Version 2.0.210806.1to install it in my Flutter project's root foldergwj41 commentedon Jun 14, 2023
Hi, I resolved this issue after I configured nuget package source with "https://nuget.cdn.azure.cn/v3/index.json"
mvanbeusekom commentedon Aug 10, 2023
This is usually caused by an configuration error regarding NuGet package manager. The permission_handler_windows package makes use of NuGet to download the
Microsoft.Windows.CppWinRTlibrary which contains is used to generate C++ header files to access the Windows native runtime SDK, needed to communicate with the GPS hardware.I am not really sure what causes the configuration error, however here are some steps that can be verified:
%appdata%\NuGet\NuGet.Config. If it doesn't exists create it with the following contents:NuGet.Configexists with the appropriate content, verify if you are allowed to connect to thehttps://api.nuget.org/v3/index.jsonurl. Some organisations are configured behind a firewall or proxy blocking access.If this all fails please run
flutter build windows -v. The-vswitch will provide verbose information and will give more feedback on why NuGet wasn't able to install theMicrosoft.Windows.CppWinRTlibrary.rajvardhant commentedon Apr 28, 2025
Fixing "Argument cannot be null or empty. Parameter name: primarySources" NuGet Error in Flutter
When working with the
permission_handler_windowspackage in Flutter, you might encounter the error:Root Cause
This issue usually arises due to a misconfiguration in NuGet package manager settings or network restrictions blocking access to the NuGet package source.
Resolution Steps
Follow the steps below to resolve the issue:
Step 1: Verify and Configure NuGet Config File
Check if the NuGet configuration file exists at this path:
%appdata%\NuGet\NuGet.ConfigUse the Run dialog (Win + R) and paste the path to locate it.
If the file doesn't exist, create it with the following content:
xml
Save and close the file.
Step 2: Add Package Source Manually
Run the following commands to manually add and verify the NuGet package source:
Add the source:
bash
Verify the source:
bash
Step 3: Install Required Tools
Ensure Visual Studio 2022 (not Visual Studio Code) is installed.
Include the "Desktop development with C++" workload during installation.
Reinstall the Windows 10 SDK, such as version
10.0.22621.0, to ensure compatibility.Step 4: Use NuGet Command to Install the Package
Download
nuget.exefrom NuGet's website.Place
nuget.exein your Flutter SDK'sbinfolder (e.g.,C:\flutter\bin).Run the following command in the terminal:
bash
By following these steps, you should be able to resolve the error and successfully install the
Microsoft.Windows.CppWinRTpackage. Feel free to share feedback or improvements in the comments section below!