简体   繁体   中英

How to reference a c# class library project(not dll) from a different solution

My project is in solution1. I want to refer a project from solution2. I could refer the dll successfully, but not the project.

I can not add the other project to my solution. In that case how can I add it as a project reference. Need some suggestions.

I have added the reference manual in the csproj file, but the build is failing.

<ProjectReference Include="..\..\Common\Project2.csproj">
      <Project>{78cd0a60-06fb-4941-323e-337f0e43c693}</Project>
      <Name>Project2</Name>
</ProjectReference>

Place both of your project in same folder (class library project and your current project)- recommended but not necessary

1) Right click your solution file and click Add --> Existing Project --> go to the folder of class library project and select project file.

2) Once the project is added to the solution, you need to add reference to your present application.

3) Now right click your project and click Add Reference

4) Select solution and check your class library project and Press OK.

5) Rebuild your solution .

6) You can now use classes and objects of class library with the use of using statement at top of your .cs files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM