简体   繁体   中英

Could not register the assembly System.ArgumentNullException: Value cannot be null - Problem with Visual Studio for Mac

I have a problem building a project by error: Could not register the assembly 'Xamarin.Essentials': System.ArgumentNullException: Value cannot be null.

Xamarin.Essential is NuGet Package: Xamarin.Essential Nuget Gallery

I did all the recommended cleaning on VS and it still doesn't work. Anyone had a similar problem?

Visual Studio for Mac - version 8.6.5 (build 23)

Xamarin.Essentials - version 1.5.3.2

Error Visual Studio description: /Users/.../App.iOS/MTOUCH: Error MT4116: Could not register the assembly 'Xamarin.Essentials': System.ArgumentNullException: Value cannot be null. (MT4116) (App.iOS)

Could not register the assembly 'Xamarin.Essentials': System.ArgumentNullException: Value cannot be null

1) close VS for Mac, delete all nuget caches under ~/.nuget/packages , ~/.local/share/NuGet/v3-cache and ~/.local/share/NuGet/plugins-cache

2) delete the whole bin and obj folder under the project folder and then restart your project again.

3) try to uninstall that Xamarin.Essentials nuget package and reinstall that package in your project to test again.

Also , try the lower version 1.3.1 .

4) you can also create a new project and then install that package to test whether the issue still persists in the new project.

I removed Visual Studio for Mac and all its dependencies with a script and installed VS with the latest version. Now it is working.

#!/bin/sh

# Uninstall Visual Studio for Mac
echo "Uninstalling Visual Studio for Mac..."

sudo rm -rf "/Applications/Visual Studio.app"
rm -rf ~/Library/Caches/VisualStudio
rm -rf ~/Library/Preferences/VisualStudio
rm -rf ~/Library/Preferences/Visual\ Studio
rm -rf ~/Library/Logs/VisualStudio
rm -rf ~/Library/VisualStudio
rm -rf ~/Library/Preferences/Xamarin/
rm -rf ~/Library/Application\ Support/VisualStudio
rm -rf ~/Library/Application\ Support/VisualStudio/7.0/LocalInstall/Addins/

# Uninstall Xamarin.Android
echo "Uninstalling Xamarin.Android..."

sudo rm -rf /Developer/MonoDroid
rm -rf ~/Library/MonoAndroid
sudo pkgutil --forget com.xamarin.android.pkg
sudo rm -rf /Library/Frameworks/Xamarin.Android.framework


# Uninstall Xamarin.iOS
echo "Uninstalling Xamarin.iOS..."

rm -rf ~/Library/MonoTouch
sudo rm -rf /Library/Frameworks/Xamarin.iOS.framework
sudo rm -rf /Developer/MonoTouch
sudo pkgutil --forget com.xamarin.monotouch.pkg
sudo pkgutil --forget com.xamarin.xamarin-ios-build-host.pkg


# Uninstall Xamarin.Mac
echo "Uninstalling Xamarin.Mac..."

sudo rm -rf /Library/Frameworks/Xamarin.Mac.framework
rm -rf ~/Library/Xamarin.Mac


# Uninstall Workbooks and Inspector
echo "Uninstalling Workbooks and Inspector..."

if [ -f "/Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/uninstall" ]; then
    sudo /Library/Frameworks/Xamarin.Interactive.framework/Versions/Current/uninstall
fi


# Uninstall the Visual Studio for Mac Installer
echo "Uninstalling the Visual Studio for Mac Installer..."

rm -rf ~/Library/Caches/XamarinInstaller/
rm -rf ~/Library/Caches/VisualStudioInstaller/
rm -rf ~/Library/Logs/XamarinInstaller/
rm -rf ~/Library/Logs/VisualStudioInstaller/

# Uninstall the Xamarin Profiler
echo "Uninstalling the Xamarin Profiler..."

sudo rm -rf "/Applications/Xamarin Profiler.app"

echo "Finished Uninstallation process."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM