Visual Studio Code와 .NET Core를 OSX에서 사용하고 있습니다.
HtmlAgilityPack.NetCore.1.5.0.1이 프로젝트 폴더에 설치되었습니다. 모든 프로젝트 파일, HTMLAgilityPack.NetCore.1.5.0.1 및 모든 종속성은 탐색기 통증에서 볼 수 있습니다. 그러나 HtmlAgilityPack 어셈블리에 대한 참조를 만들 수는 없습니다.
코드는 간단합니다. 컴파일되고 실행됩니다.
namespace ConsoleApplication
{
using System;
using System.Text.RegularExpressions;
using System.Linq;
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello, world");
}
}
}
이 기능을 수행하기 위해 수행해야 할 nuget 패키지를 설치하는 것 이상의 단계가 있습니까?
내가 당신의 질문을 오해하지 않는 한, 이것은 아주 솔직해야합니다. 당신이해야 할 일은 :
1 : nuget 패키지를 project.json
파일에 추가 한 다음 project.json
파일과 동일한 디렉토리에서 dotnet dotnet restore
를 실행하여 새로 추가 된 패키지를 복원하십시오.
...
},
"dependencies": {
"HtmlAgilityPack.NetCore": "1.5.0.1"
},
"frameworks": {
...
2 : 코드의 맨 위에 다음 using 문을 추가하십시오.
using HtmlAgilityPack;
이것은 나를 위해 작동합니다 :
namespace ConsoleApplication
{
using System;
using HtmlAgilityPack;
public class Program
{
public static void Main(string[] args)
{
HtmlDocument doc = new HtmlDocument();
Console.WriteLine("Hello, world");
}
}
}
참고 : OSX에서 Visual Studio Code를 사용하면서 클래스를 참조한 다음 CMD + .
바로 가기를 누를 수 있습니다 CMD + .
Visual Studio Code의 도구 창을 불러오고 누락 된 using 문을 자동으로 가져옵니다.