在Visual Studio中的相同解决方案中引用项目

编程入门 行业动态 更新时间:2024-10-20 16:28:29
本文介绍了在Visual Studio中的相同解决方案中引用项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两个项目的解决方案.项目之一是带有DLL文件的库.我希望能够在其他项目中引用该项目库以使用其类.我的最终目标是做到这一点,同时仍然可以访问库的源代码.我尝试引用.dll,也尝试引用.csproj.两种情况都可以,但是我收到代码CS0436的120条警告:

I have a Solution with two projects. One of the projects is a library with a DLL file. I want to be able to reference this project library in the other project to use its classes. My end goal is to do this, while still having access to the libraries source code. I've tried referencing the .dll, I've also tried referencing the .csproj. Both cases work but I get 120 warnings for code CS0436:

Warning CS0436 The type 'BitField' in 'C:\FilePath' conflicts with the imported type 'Typename' in 'LibraryName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\FilePath'. LibraryName C:\FilePath 38 Active

我已经花了一个多小时阅读本网站上的MSDN指南和其他文章.因此,如果没有人将其标记为重复线程,我将不胜感激.

I've spent over an hour reading MSDN guides and other posts on this site. Because of this, I would greatly appreciate if no one labels this as a duplicate thread.

推荐答案

您只需要右键单击项目,然后选择添加"->引用".在此窗口中,从左侧标签中选择项目,然后选择具有dll输出的项目.

You only need to right click on your project and choose Add -> Reference.. In this window choose projects from the left tab and select your project with dll output.

还请确保您的项目具有与其目标相同的.Net框架.

Also be sure your projects has the same .Net framework as their targets.

祝你好运

更多推荐

在Visual Studio中的相同解决方案中引用项目

本文发布于:2023-11-13 14:39:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584600.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   项目   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!