not a showstopper but when using nuget in a project, it creates a packages.config file with this shape
<?xml version="1.0" encoding="utf-8"?>
<packages>
... your packages
</packages>
this gives a warning in VS
The 'packages' element is not declared.
The origin of the problem got something to do with the xml declaration I guess.
Also I think that the default definition package shouldn't throw warnings.
Does anyone know what should I change it to so I don't get this warning? (ie even if I can see it only when the file is open, it also shows as a warning constantly with certain CA rules on.)
Actually the correct answer to this is to just add the schema to your document, like so
...and you're done :)
If the XSD is not already cached and unavailable, you can add it as follows from the NuGet console
Once this is done, as noted in a comment below, you may want to move it from your current folder to the official schema folder that is found in
None of the answers will solve your problem permanently. If you go to the path of adding XSD (From Xml menu, select "Create schema"), you will end up having problems with the package manager as it will clean up your packages.config file when you add a new package.
The best solution is just ignore by closing the file when you don't use it.
You will see it only when the file is open. When you'll close the file in Visual Studio the warnings goes away
http://nuget.codeplex.com/discussions/261638
The problem is, you need a xsd schema for
packages.config
.This is how you can create a schema (I found it here):
Open your Config file -> XML -> Create Schema
This would create a
packages.xsd
for you, and opens it in Visual Studio:In my case,
packages.xsd
was created under this path:C:\Users\MyUserName\AppData\Local\Temp
Now I don't want to reference the
packages.xsd
from a Temp folder, but I want it to be added to my solution and added to source control, so other users can get it... so I copiedpackages.xsd
and pasted it into my solution folder. Then I added the file to my solution:1. Copy
packages.xsd
in the same folder as your solution2. From VS, right click on solution -> Add -> Existing Item... and then add
packages.xsd
So, now we have created
packages.xsd
and added it to the Solution. All we need to do is to tell the config file to use this schema.Open the config file, then from the top menu select:
XML -> Schemas...
Add your
packages.xsd
, and select Use this schema (see below)This happens because VS doesn't know the schema of this file. Note that this file is more of an implementation detail, and not something you normally need to open directly. Instead, you can use the NuGet dialog to manage the packages installed in a project.
You can always make simple xsd schema for 'packages.config' to get rid of this warning. To do this, create file named "packages.xsd":
Location of this file (two options)
packages.xsd
across multiple projects, move it to the Visual Studio Schemas folder (the path may slightly differ, it'sD:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas
for me).Then, edit
<packages>
tag inpackages.config
file (addxmlns
attribute):Now the warning should disappear (even if packages.config file is open in Visual Studio).