너겟 '패키지'요소가 경고로 선언되지 않았습니다.
showstopper는 아니지만 프로젝트에서 nuget을 사용할 때이 모양의 packages.config 파일을 만듭니다.
<?xml version="1.0" encoding="utf-8"?>
<packages>
... your packages
</packages>
이것은 VS에서 경고를줍니다.
The 'packages' element is not declared.
문제의 기원은 내가 생각하는 XML 선언과 관련이 있습니다.
또한 기본 정의 패키지는 경고를 발생시키지 않아야한다고 생각합니다.
이 경고 메시지가 나타나지 않도록 무엇을 변경해야하는지 알고 있습니까? (즉, 파일이 열려있을 때만 볼 수있는 경우에도 특정 CA 규칙이 설정된 경우 계속 경고로 표시됩니다.)
'packages.config'에 대해 간단한 xsd 스키마를 만들어이 경고를 제거 할 수 있습니다. 이렇게하려면 "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>
이 파일의 위치 (두 가지 옵션)
- 'packages.config'파일과 같은 폴더에
packages.xsd
여러 프로젝트에서 공유 하려면 Visual Studio Schemas 폴더로 옮깁니다 (경로가 약간 다를 수 있음D:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas
).
그런 다음 파일 <packages>
에서 태그를 편집 packages.config
하십시오 ( xmlns
속성 추가 ).
<packages xmlns="urn:packages">
이제 패키지가 Visual Studio에서 열려 있더라도 경고가 사라집니다.
파일이 열려있을 때만 볼 수 있습니다. Visual Studio에서 파일을 닫으면 경고가 사라집니다.
http://nuget.codeplex.com/discussions/261638
실제로 이에 대한 정답은 스키마를 문서에 추가하는 것입니다.
<packages xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
... 그리고 당신은 끝났습니다 :)
XSD가 아직 캐시되지 않아 사용할 수없는 경우 NuGet 콘솔에서 다음과 같이 추가 할 수 있습니다.
Install-Package NuGet.Manifest.Schema -Version 2.0.0
이 작업이 완료되면 아래 주석에 언급 된대로 현재 폴더에서이 폴더의 공식 스키마 폴더로이 폴더를 이동할 수 있습니다.
%VisualStudioPath%\Xml\Schemas
어떤 대답도 문제를 영구적으로 해결하지는 못합니다. XSD 추가 경로 (Xml 메뉴에서 "스키마 생성"선택)로 이동하면 새 패키지를 추가 할 때 packages.config 파일을 정리하므로 패키지 관리자에 문제가 발생합니다.
가장 좋은 해결책은 파일을 사용하지 않을 때 파일을 닫아서 무시하는 것입니다.
VS가이 파일의 스키마를 알지 못하기 때문에 발생합니다. 이 파일은 구현에 대한 자세한 내용이며 일반적으로 직접 열어야하는 것은 아닙니다. 대신 NuGet 대화 상자를 사용하여 프로젝트에 설치된 패키지를 관리 할 수 있습니다.
문제는에 대한 xsd 스키마가 필요하다는 것입니다 packages.config
.
이것은 스키마를 만드는 방법입니다 ( 여기에서 찾았습니다) .
구성 파일-> XML-> 스키마 작성을여십시오.
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 copied packages.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 solution
2. 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 seemed to work even after adding a new package:
I added the following !DOCTYPE above the root element:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE packages [
<!ELEMENT packages (package*)>
<!ELEMENT package EMPTY>
<!ATTLIST package
id CDATA #REQUIRED
version CDATA #REQUIRED
targetFramework CDATA #REQUIRED
developmentDependency CDATA #IMPLIED>
]>
참고URL : https://stackoverflow.com/questions/6774578/nuget-packages-element-is-not-declared-warning
'development' 카테고리의 다른 글
프로그래밍 방식으로 버튼을 숨기는 방법? (0) | 2020.06.24 |
---|---|
PHP에서 둘 이상의 클래스를 사용하여 클래스를 확장 할 수 있습니까? (0) | 2020.06.24 |
sc.exe로 서비스를 만들 때 컨텍스트 매개 변수를 전달하는 방법은 무엇입니까? (0) | 2020.06.24 |
elasticsearch bool 쿼리는 OR과 결합해야합니다 (0) | 2020.06.24 |
각 목록 항목 뒤에 이미지 삽입 (0) | 2020.06.24 |