Unity 프로젝트에서 기본적으로 컴파일되지 않는 .NET 클래스 라이브러리 API의 일부에 액세스해야 하는 경우 프로젝트에서 Unity의 C# 컴파일러에 알릴 수 있습니다. 이 동작은 프로젝트에서 사용하는 .NET 프로파일에 따라 다릅니다.
프로젝트에서 .NET Standard 2.0 API 호환성 레벨을 사용하는 경우 .NET 클래스 라이브러리 API의 일부를 사용하기 위해 추가로 해야 하는 작업은 없습니다. API의 일부가 없는 것처럼 보이면 .NET Standard 2.0과 함께 포함되어 있지 않기 때문일 수 있습니다. 이 경우 프로젝트에서 .NET 4.x API 호환성 레벨을 대신 사용해야 할 수 있습니다.
Unity에서는 NET 4.x API 호환성 레벨을 사용하는 경우 기본적으로 다음 어셈블리를 참조합니다.
csc.rsp 파일을 사용하여 다른 클래스 라이브러리 어셈블리를 참조하십시오. 이 파일을 Unity 프로젝트의 Assets 디렉토리에 추가하여 커맨드 라인 인자를 C# 컴파일러에 추가로 전달하는 데 사용할 수 있습니다. 예를 들어 System.Net.Http.dll
어셈블리에서 정의되는 HttpClient
클래스를 프로젝트에서 사용하는 경우 C# 컴파일러에서 다음과 같은 초기 오류 메시지를 표시할 수 있습니다.
`HttpClient` 타입은 레퍼런스되지 않는 어셈블리에서 정의됩니다. 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 어셈블리에 대한 레퍼런스를 추가해야 합니다.
이 오류를 해결하려면 다음 csc.rsp 파일을 프로젝트에 추가하십시오.
-r:System.Net.Http.dll
위 예의 설명대로 클래스 라이브러리 어셈블리를 참조해야 합니다. 어셈블리 파일을 프로젝트의 Assets
폴더 또는 이 폴더의 하위 폴더에 배치해야 합니다.
csc.rsp 파일을 사용하여 클래스 라이브러리 어셈블리를 참조하는 경우 주의하십시오. API 호환성 레벨 을 .NET 4.x에서 .NET Standard 2.0으로 변경하는 경우 위 예와 같은 csc.rsp 파일이 프로젝트에 있으면 C# 컴파일에 실패합니다. System.Net.Http.dll 어셈블리는 .NET Standard 2.0 프로파일에 없으므로 C# 컴파일러가 이 어셈블리를 찾을 수 없습니다.
csc.rsp 파일에는 최신 .NET 프로파일에만 해당하는 부분이 있을 수 있습니다. 프로파일을 변경하는 경우 csc.rsp 파일도 수정해야 합니다.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.