VS2015 - "NuGetPackage" package loaded incorrectly

Just opened VS 2015 Enterprise RTM, opened an existing working project, receiving the following error:




Microsoft Visual Studio




The 'NuGetPackage' package did not load correctly.

The problem may be caused by a configuration change or by installing another extension. You can get more information by looking at the file C:\Users\REDACTED\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml .

Restarting Visual Studio may help resolve this issue.

Continue to display this error message?




[Well no]




Restarting did not help. I looked at the log file and found the following sections related to nuget:

 <entry> <record>555</record> <time>2015/07/20 16:06:34.364</time> <type>Error</type> <source>Extension Manager</source> <description>Extension will not be loaded because an extension with the same ID &apos;Microsoft.Dev14.VsixTemplatesPackage.443cca91-ec20-41e5-a165-f28e56b89650&apos; is already loaded at C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\ EXTENSIONS\G2URSPAC.VAZ\...</description> <path>C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\ NUGETIFIEDEXTENSIBILITYTEMPLATES\</path> </entry> <entry> <record>556</record> <time>2015/07/20 16:06:34.364</time> <type>Error</type> <source>Extension Manager</source> <description>Extension will not be loaded because an extension with the same ID &apos;Microsoft.VisualStudio.TeamFoundation.TeamExplorer.Extensions&apos; is already loaded at C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\ B1NUOYPH.H2N\...</description> <path>C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\COMMONEXTENSIONS\ MICROSOFT\TEAMFOUNDATION\TEAM EXPLORER\</path> </entry> 

What a duplicate extension will offer, but it doesn't look like an extension manager.

This is on the machine on which VS2013 is installed. He did not have any VS2015 pre-builds / RCs ever installed.

+52
visual-studio-2015 nuget
Jul 20 '15 at 16:17
source share
10 answers

Completely uninstalling NuGet through extensions and updates, rebooting VS, and then reinstalling NuGet through extensions and updates, solved the problem for me. A complete reinstall of VS is not needed.

+59
Jul 20 '15 at 16:50
source share

Updating Nuget to the latest version seems to have solved the problem.

  • Tools> Extensions and Updates

  • Updates> Visual Studio Gallery

  • Click Update in Nuget Package Manager

+26
Sep 09 '15 at 5:54 on
source share

After a completely clean install of Visual Studio Professional 2015 from the MSDN website, I started VS2015 as an administrator, opened the package manager console with Tools -> NuGet Package Manager... -> Package Manager Console , and I got this error:

 "Windows PowerShell updated your execution policy successfully, but the setting is overridden by a policy defined at a more specific scope. Due to the override, your shell will retain its current effective execution policy of Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more information please see "Get-Help Set-ExecutionPolicy" 

Following the steps above to

1) Use Tools -> Extensions and Updates... to remove NuGet Package Manager for Visual Studio 2015 .

2) Restart Visual Studio.

3) Use Tools -> Extensions and Updates... to reinstall NuGet Package Manager for Visual Studio 2015 .

4) Restart Visual Studio.

Now, when I open the package manager console, Powershell loads correctly, and everything is fine. Thanks so much for that!

+6
Sep 16 '15 at 22:39
source share

Keep in mind

Reinstalling the NuGet package manager does NOT seem to delete the existing NuGet.Config file stored in c: \ users \ name \ AppData \ Roaming \ NuGet!

Mine did not have a "packagesSources" section (why, I don’t know), but since this file was not recreated, NuGet still does not work!

So, either manually enter this section, or delete this configuration file, and then reinstall NuGet through extensions and updates that recreate the new one!

+5
Apr 7 '16 at 7:51
source share

Removing all the files from this folder C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\imf5jbeu.eak seemed to work for me.

+2
Sep 29 '15 at 14:45
source share

It seems that nuget in VS2015 is configured to display only microsoft packages. To be able to search for all packages in nuget.org, go to Tools> Options> NuGet Package Manager> Package Sources, click Add, put nuget.org as Name and https: // www.nuget.org/api/v2/ as the source, then click OK. Now in Nuget Package Manager, you can select nuget.org (or All) as the source of the package, and you can search for all packages (and not just those that come from Microsoft).

+2
May 12 '16 at 9:03
source share

I had the same problem and it was solved using the solution already mentioned, but it took more attempts. It is necessary to completely restart VS after uninstalling and installing the NuGetPackage extension, and it did not work on my system until I closed my open solution. We hope that the NuGetPackage extension will become more stable in the near future.

0
Jul 21 '15 at 9:46
source share

When upgrading projects with nuget packages from Vx20XX to VS2015, a problem with nuget packages may occur.

Example error message: This project refers to NuGet packages that are not available on this computer. Turn on NuGet package recovery to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105 .

I fixed my problem by writing a small program that does MSBuild-integrated package recovery and automatic package recovery

You can download the executable file of the tool here .

Please let me know the result :-)!

Screenshot

Code as a reference:

 <Window x:Class="FixNuGetProblemsInVs2015.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:FixNuGetProblemsInVs2015" mc:Ignorable="d" Title="Fix NuGet Packages problems in Visual Studio 2015 (By Eric Ouellet)" Height="350" Width="525"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="*"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="10"></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock Grid.Row="0" Grid.Column="0">Root directory of projects</TextBlock> <Grid Grid.Row="0" Grid.Column="2"> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBox Grid.Column="0" Name="DirProjects"></TextBox> <Button Grid.Column="1" VerticalAlignment="Bottom" Name="BrowseDirProjects" Click="BrowseDirProjectsOnClick">Browse...</Button> </Grid> <!--<TextBlock Grid.Row="1" Grid.Column="0">Directory of NuGet Packages</TextBlock> <Grid Grid.Row="1" Grid.Column="2"> <Grid.ColumnDefinitions> <ColumnDefinition></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBox Grid.Column="0" Name="DirPackages"></TextBox> <Button Grid.Column="1" Name="BrowseDirPackages" Click="BrowseDirPackagesOnClick">Browse...</Button> </Grid>--> <TextBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Name="TxtLog" IsReadOnly="True"></TextBox> <Button Grid.Row="3" Grid.Column="0" Click="ButtonRevertOnClick">Revert back</Button> <Button Grid.Row="3" Grid.Column="2" Click="ButtonFixOnClick">Fix</Button> </Grid> </Window> using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Xml; using System.Xml.Linq; using Application = System.Windows.Application; using MessageBox = System.Windows.MessageBox; /// <summary> /// Applying recommanded modifications in section : "MSBuild-Integrated package restore vs. Automatic Package Restore" /// of : http://docs.nuget.org/Consume/Package-Restore/Migrating-to-Automatic-Package-Restore /// </summary> namespace FixNuGetProblemsInVs2015 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DirProjects.Text = @"c:\prj"; // DirPackages.Text = @"C:\PRJ\NuGetPackages"; } private void BrowseDirProjectsOnClick(object sender, RoutedEventArgs e) { FolderBrowserDialog dlg = new FolderBrowserDialog(); dlg.SelectedPath = DirProjects.Text; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DirProjects.Text = dlg.SelectedPath; } } //private void BrowseDirPackagesOnClick(object sender, RoutedEventArgs e) //{ // FolderBrowserDialog dlg = new FolderBrowserDialog(); // dlg.SelectedPath = DirPackages.Text; // if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) // { // DirPackages.Text = dlg.SelectedPath; // } //} // private string _dirPackages; private void ButtonFixOnClick(object sender, RoutedEventArgs e) { DoJob(false); } private void ButtonRevertOnClick(object sender, RoutedEventArgs e) { DoJob(true); } private void DoJob(bool revert = false) { TxtLog.Text = ""; string dirProjects = DirProjects.Text; // _dirPackages = DirPackages.Text; if (!Directory.Exists(dirProjects)) { MessageBox.Show("Projects directory does not exists: " + dirProjects); return; } //if (!Directory.Exists(_dirPackages)) //{ // MessageBox.Show("Packages directory does not exists: " + _dirPackages); // return; //} RecurseFolder(dirProjects, revert); } private void RecurseFolder(string dirProjects, bool revert = false) { if (revert) { Revert(dirProjects); } else { FixFolder(dirProjects); } foreach (string subfolder in Directory.EnumerateDirectories(dirProjects)) { RecurseFolder(subfolder, revert); } } private const string BackupSuffix = ".fix_nuget_backup"; private void Revert(string dirProject) { foreach (string filename in Directory.EnumerateFiles(dirProject)) { if (filename.ToLower().EndsWith(BackupSuffix)) { string original = filename.Substring(0, filename.Length - BackupSuffix.Length); if (File.Exists(original)) { File.Delete(original); } File.Move(filename, original); Log("File reverted: " + filename + " ==> " + original); } } } private void FixFolder(string dirProject) { BackupFile(System.IO.Path.Combine(dirProject, "nuget.targets")); BackupFile(System.IO.Path.Combine(dirProject, "nuget.exe")); foreach (string filename in Directory.EnumerateFiles(dirProject)) { if (filename.ToLower().EndsWith(".csproj")) { FromProjectFileRemoveNugetTargets(filename); } } } private void BackupFile(string path) { if (File.Exists(path)) { string backup = path + BackupSuffix; if (!File.Exists(backup)) { File.Move(path, backup); Log("File backup: " + backup); } else { Log("Project has already a backup: " + backup); } } } private void FromProjectFileRemoveNugetTargets(string prjFilename) { XDocument xml = XDocument.Load(prjFilename); List<XElement> elementsToRemove = new List<XElement>(); foreach (XElement element in xml.Descendants()) { if (element.Name.LocalName == "Import") { var att = element.Attribute("Project"); if (att != null) { if (att.Value.Contains("NuGet.targets")) { elementsToRemove.Add(element); } } } if (element.Name.LocalName == "Target") { var att = element.Attribute("Name"); if (att != null && att.Value == "EnsureNuGetPackageBuildImports") { elementsToRemove.Add(element); } } } if (elementsToRemove.Count > 0) { elementsToRemove.ForEach(element => element.Remove()); BackupFile(prjFilename); xml.Save(prjFilename); Log("Project updated: " + prjFilename); } } private void Log(string msg) { TxtLog.Text += msg + "\r\n"; } } } 
0
Oct 22 '15 at 18:14
source share

Go to:

Instruments
Extensions and Updates

Paste Nuget Package Manager into the search field on the right and configure it (full configuration).

After that, you will have the Nuget package management package in the Tools section.

0
Jan 30 '16 at 10:02
source share

I found this on google, got a similar error: the "NuGetPackage" package did not load correctly.

An error occurred while reading the xxx file. There are duplicate packages.

Check the packages.config file in each project and remove the duplicated package line from it, and it should work.

0
Jun 07 '16 at 16:59
source share



All Articles