xml - nuget 'packages' element is not declared warning -
not showstopper when using nuget in project, creates packages.config file shape
<?xml version="1.0" encoding="utf-8"?> <packages> ... packages </packages>
this gives warning in vs
the 'packages' element not declared.
the origin of problem got xml declaration guess.
also think default definition package shouldn't throw warnings.
does know should change don't warning? (ie if can see when file open, shows warning ca rules on.)
you can make simple xsd schema 'packages.config' rid of warning. this, create file named "packages.xsd":
<?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified" targetnamespace="urn:packages" xmlns="urn:packages"> <xs:element name="packages"> <xs:complextype> <xs:sequence> <xs:element name="package" maxoccurs="unbounded"> <xs:complextype> <xs:attribute name="id" type="xs:string" use="required" /> <xs:attribute name="version" type="xs:string" use="required" /> <xs:attribute name="targetframework" type="xs:string" use="optional" /> <xs:attribute name="allowedversions" type="xs:string" use="optional" /> </xs:complextype> </xs:element> </xs:sequence> </xs:complextype> </xs:element> </xs:schema>
location of file (two options)
- in same folder 'packages.config' file,
- if want share
packages.xsd
across multiple projects, move visual studio schemas folder (the path may differ, it'sd:\program files (x86)\microsoft visual studio 10.0\xml\schemas
me).
then, edit <packages>
tag in packages.config
file (add xmlns
attribute):
<packages xmlns="urn:packages">
now warning should disappear (even if packages.config file open in visual studio).
Comments
Post a Comment