etalon11
etalon11

Reputation: 984

Nuget-Package on other pc won't load

I am sure, this problem already is described here, but I didn't found it.

I have a project which I developed on a pc and made a repo on github. Now I downloaded this project on a new pc with a fresh Visual Studio 2015. I have in mind that the nuget-packages get downloaded when I run or compile my project.

My nuget-file:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="log4net" version="2.0.5" targetFramework="net45" />
  <package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" />
</packages>

Somhow the IDE marks "packages" whith "package-element not declared".

Upvotes: 0

Views: 894

Answers (2)

etalon11
etalon11

Reputation: 984

I managed to solve this by switching to the previous package-version and then back to the current package-version of my nuget-packages.

This is not the best solution, but it helped me out. Maybe the problem just occured, because it was a fresh installation of Visual Studio which has never opened before.

Upvotes: 0

Matt Ward
Matt Ward

Reputation: 47987

The packages element not declared is from the XML editor if you have the packages.config file open. If you close that file the error will disappear. It has nothing to do with NuGet not restoring your packages.

Visual Studio is using the wrong XML schema for the packages.config file so is indicating an XML error which you can ignore. If you open the Properties window you will see Visual Studio has associated some schemas to the packages.config file. You do not seem to be able to remove the associations.

If your project builds then NuGet has restored the packages correctly.

A search for the packages element not declared message finds another StackOverflow post with this error and how to resolve it.

Upvotes: 1

Related Questions