ASP.NET 5 - 프로젝트의 파일 참조(csproj와 유사한 참조 누락) (ASP.NET 5 - Referencing files in projects (missing csproj-like references))


문제 설명

ASP.NET 5 ‑ 프로젝트의 파일 참조(csproj와 유사한 참조 누락) (ASP.NET 5 ‑ Referencing files in projects (missing csproj‑like references))

저는 Visual Studio 2015를 사용하여 ASP.NET 5 앱을 개발 중입니다. 하나의 솔루션에서 여러 프로젝트를 작업하는 등 RC1 이후로는 전혀 문제가 없습니다.

하지만 며칠 동안 VS Code로 작업해야 하는데 수업 누락 문제를 해결하는 방법을 잘 모르겠습니다. 프로젝트 A와 프로젝트 B에 대한 솔루션이 있다고 가정 해 봅시다. 내부에 자체 클래스가 있습니다. 이전 버전의 ASP.NET에서는 모든 파일이 .csproj 파일에서 참조되었지만 지금은 .xproj 파일이 거의 비어 있습니다. 파일에 대한 직접 경로는 없습니다. 그리고 내 프로젝트 A에서 새 클래스를 만들었습니다. 모든 올바른 네임스페이스가 있고 프로젝트 B에는 A에 대한 참조가 있습니다(프로젝트 B의 컨트롤러도 동일한 A의 네임스페이스에서 클래스를 사용합니다!). 그러나 컴파일 오류가 있습니다. 프로젝트 A에서 내 수업을 찾을 수 없습니다 :/

VS Code를 사용하면 새 파일에 대해 컴파일러에 알리기 위해 프로젝트에 일종의 참조를 추가해야 한다고 생각했지만 올바른 위치를 찾을 수 없습니다. 어떤 아이디어가 있습니까?


참조 솔루션

방법 1:

You do this in the project.json file.

{
  "dependencies": {
    "ProjectA": "1.0.0‑*"
  }
}

You declare the dependency. If the source is available in the solution folder, it will find it and use it. If the source isn't available, it can pull down a NuGet package that matches the version number. The documentation I linked to above provides more information about this process.

Once you have a dependency registered, you can refer to the public classes in your project. You'll need to fully qualify the dependencies (use the full namespace) or add a using <namespace> directive at the top of your file.

(by psmyrdekmason)

참조 문서

  1. ASP.NET 5 ‑ Referencing files in projects (missing csproj‑like references) (CC BY‑SA 2.5/3.0/4.0)

#asp.net-core #ASP.NET






관련 질문

ASP.NET 5 프로젝트용 DNX를 선택하는 방법 (How to choose DNX for ASP.NET 5 project)

ASP.NET 5 - 프로젝트의 파일 참조(csproj와 유사한 참조 누락) (ASP.NET 5 - Referencing files in projects (missing csproj-like references))

ASP.NET 5에 OData를 등록하는 방법 (How to register OData with ASP.NET 5)

Asp.net 5 - 도커 (Asp.net 5 - Docker)

ASP.NET Core MVC에서 컨트롤러별로 데이터베이스에서 정보 읽기 (Reading information from database by controller in ASP.NET Core MVC)

이 목록에 정렬 오류가 있는 이유는 무엇입니까? (Why is there a sorting error in this list?)

foreach 루프에서 모든 데이터를 반환하는 방법 (How to return all data in foreach loop)

읽기 전용 면도기 C# asp.net의 드롭다운 목록을 만드는 방법 (how to make dropdownlistfor readonly razor c# asp.net)

.net Core: C# 코드에서 매개 변수를 전달하고 Azure 데이터 팩터리 파이프라인을 실행하는 방법은 무엇입니까? (.net Core : How to pass parameters and run Azure data factory pipeline from C# Code?)

현재 .NET SDK는 TFS 2015 빌드에서 .NET Core 3.0 대상 지정을 지원하지 않습니다. (The current .NET SDK does not support targeting .NET Core 3.0 on TFS 2015 build)

HTTP 오류 500.30 - ANCM 진행 중인 시작 실패 Asp.net-Core 3.1 (HTTP Error 500.30 - ANCM In-Process Start Failure Asp.net-Core 3.1)

System.Data.SqlClient.TdsParser' 예외가 발생했습니다: System.BadImageFormatException: 잘못된 형식의 프로그램을 로드하려고 했습니다. (System.Data.SqlClient.TdsParser' threw an exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format)







코멘트