Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type initializer for 'Nuget.EnvironmentUtility' threw an exception

I'm on my second computer with this same issue. I assume it's got to be a combination of tools I use in Visual Studio, but I often get this error.

Install-Package : The type initializer for 'NuGet.EnvironmentUtility' threw an exception.
At line:1 char:35
+ get-project -all | Install-Package <<<<  xamarin.forms
    + CategoryInfo          : NotSpecified: (:) [Install-Package], TypeInitializationException
    + FullyQualifiedErrorId : System.TypeInitializationException,NuGet.PowerShell.Commands.InstallPackageCommand

I end up messing around with uninstalling/reinstalling nuget, rebooting my machine, and deleting config files until it works again. I never know exactly which part actually fixed it.

Has anyone else seen this? What are the right steps to resolve?


Microsoft Visual Studio Professional 2013 Version 12.0.31101.00 Update 4 Microsoft .NET Framework Version 4.5.50938

Installed Version: Professional

Team Explorer for Visual Studio 2013 06177-004-0444002-02083 Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013 06177-004-0444002-02083 Microsoft Visual Basic 2013

Visual C# 2013 06177-004-0444002-02083 Microsoft Visual C# 2013

Visual C++ 2013 06177-004-0444002-02083 Microsoft Visual C++ 2013

Visual F# 2013 06177-004-0444002-02083 Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker
06177-004-0444002-02083 Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Application Insights Tools for Visual Studio Package 1.0 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 12.4.51016.0 Microsoft Web Developer Tools contains the following components: Support for creating and opening ASP.NET web projects Browser Link: A communication channel between Visual Studio and browsers Editor extensions for HTML, CSS, and JavaScript Page Inspector: Inspection tool for ASP.NET web projects Scaffolding: A framework for building and running code generators Server Explorer extensions for Microsoft Azure Websites Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2 4.1.21001.0 For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.21010.0 For additional information, visit http://www.asp.net/

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

JetBrains ReSharper Platform 6 Build 6.0.20141219.120158 on 2014-12-19 12:56:02Z JetBrains ReSharper Platform package for Microsoft Visual Studio. For more information about ReSharper Platform, visit http://www.jetbrains.com/resharper. Copyright © 2015 JetBrains, Inc.

Microsoft Azure Mobile Services Tools 1.3 Microsoft Azure Mobile Services Tools

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

PowerShell Tools 1.3 Provides file classification services using PowerShell

PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools 12.0.41012.0 Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration 1.0 This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Xamarin 3.11.445.0 (5061f92) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android 5.1.0.115 (d23da369e436488f38c8ab8fe8a9ae7d9ea5256b) Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense 1.0 Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS 8.10.0.0 (7741cc495ab0baf04ff0405d0604bc27f0ecae2e) Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration 1.0 Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration 1.0 Early preview of Xamarin Test Cloud integration

like image 889
Chase Florell Avatar asked May 02 '15 19:05

Chase Florell


Video Answer


2 Answers

I was getting this and solved it by closing ALL instances of VS before reopening the solution with the problem.

like image 183
Jason Steele Avatar answered Oct 24 '22 02:10

Jason Steele


Have gotten the exact same issue multiple times and have not been able to figure it out. Seeing your list of installs make me think it must be a mix of Visual Studio, ReSharper, and Xamarin, which I also have installed.

I just really do not want to give up my ReSharper!

edit: I have seen a bug or two created for very similar issues involving Xamarin's Visual Studio plugin generating weird errors. The one I saw is supposed to be fixed or will be in alpha soon. Although I cannot say for sure if it will address this specific issue. If I find the link to the bug again I will post it here.

like image 29
hvaughan3 Avatar answered Oct 24 '22 02:10

hvaughan3