简体   繁体   English

尝试从库向主项目添加文件时出现错误?

[英]Getting error when try to add a file from library to main project?

I have created a library in c# and add this library to my project but I can't configure how to use the library file to the main project 我已经在c#中创建了一个库并将该库添加到我的项目中,但是我无法配置如何将库文件用于主项目

I have tried the using line 我已经尝试过使用线

using UserManagment.helper;

I am getting the error at UserManagment.helper while my original project is HPS. 我的原始项目是HPS时,我在UserManagment.helper中收到错误。 the error is listed below : 错误在下面列出:

Error 2 The type or namespace name 'UserManagment' could not be found (are you missing a using directive or an assembly reference?) C:\\Users\\Ayesha\\documents\\visual studio 2013\\Projects\\HPS\\HPS\\GUI\\AdminProfile.cs 12 7 HPS 错误2找不到类型或名称空间名称'UserManagment'(您是否缺少using指令或程序集引用?)C:\\ Users \\ Ayesha \\ documents \\ visual studio 2013 \\ Projects \\ HPS \\ HPS \\ GUI \\ AdminProfile。 cs 12 7 HPS

I expect that the UserManagment .helper will successfully be used by the project and declared in my required file 我希望UserManagment .helper将被项目成功使用并在我所需的文件中声明

As discussed in the comments, you need to add the .dll as a reference to the project then only you will be able to access them in your project. 正如评论中所讨论的,您需要添加.dll作为对项目的引用,然后只有您才能在项目中访问它们。

In Solution Explorer, right-click on the References or Dependencies node and choose Add Reference. 在解决方案资源管理器中,右键单击“引用或依赖项”节点,然后选择“添加引用”。 You can also right-click on the project node and select Add > Reference. 您也可以右键单击项目节点,然后选择添加>参考。

例

Use the browse button to locate the specific .dll and add the same to the project. 使用浏览按钮找到特定的.dll并将其添加到项目中。 Read more about this option here 在此处阅读有关此选项的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么从类库项目添加dll文件时出现错误:错误Provider1上的错误? - Why when adding dll file from Class Library project i'm getting error: Error on error Provider1? 我尝试在VS中添加文件时加载类型库/ DLL时出错(HRESULT:0x80029C4A) - Error loading type library/DLL when I try to add file in VS (HRESULT: 0x80029C4A) 当我尝试 Output 时出现错误 从下拉列表中选择了什么 - Getting an Error When I Try To Output What Was Chosen From a Dropdown 从主项目中查找类库资源 - Find resources of Class Library from Main Project 尝试单击插入按钮时在 C# 项目中出现格式错误 - Getting format error in C# project when try to click insert button 尝试在Excel外接程序项目中打开OpenFileDialog框时出现STA错误 - Getting STA error when try to open OpenFileDialog box in Excel addin project 当我尝试从SkyDrive下载文件时出错 - Error when I try to download file from SkyDrive 当我尝试在项目 c# 核心 3 中添加新的 PackageReference 时显示错误 - an error is diplayed when i try to add a new PackageReference in project c# core 3 如何将依赖项从库项目复制到主项目? - How can I copy dependencies from a library project to the main project? 当我添加新用户并尝试在下一行添加声明时,我在正文中引用了错误 - I am getting error quoted in the body when I add new user and try adding claim in the next line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM