简体   繁体   中英

Can't add a reference in Visual Studio

I got a problem while adding a reference in a C# project.

I want to add hLib.dll to my project, so I right click on my project name -> add reference -> browse it and add it.

But when I go and write "using hLib;" I get this error:

The type or namespace name 'hLib' could not be found (are you missing a using directive or an assembly reference?)

 ###FIXED###
Thanks for your help!

In the Solution explorer under the project, expand the References node and double click on hLib. That will open the object browser where you can see what the actual namespaces in the dll are.

From there you can see what to put in the using statement

Find the Object Browser by opening the solution explorer, and right clicking references > hLib.dll

You can then look into it to find the namespace, classes and other objects.

I had a similar issue using Visual Studio 2017; error message (see image below) when trying to "add a reference" to a project. The issue was resolved by uninstalling a previous version of Visual Studio (2012) installed in my computer. ResourceManagerPackage error windows

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