?
Solved

Add/Link home grown dll to a project

Posted on 2014-01-14
7
Medium Priority
?
510 Views
Last Modified: 2014-01-16
I have created a dll, and would like to link that to a project that I am working on,  The MSDN documents suggest that I use Project->References->Common Properties->Add New Reference, but when I do, there is nothing there.  MSDN also suggests that I press the BROWSE button, but that button doesn't exist.

Any help will be greatly appreciated.
0
Comment
Question by:rickhill11
  • 4
  • 2
7 Comments
 
LVL 3

Expert Comment

by:fredvr666
ID: 39779434
What version of Visual studio you are using?
0
 

Author Comment

by:rickhill11
ID: 39779437
Sorry, VS2012 VC++
0
 

Author Comment

by:rickhill11
ID: 39779562
When I click on Add New Referenced I get a new dialog with "No items found", and there is not a Browse button.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:rickhill11
ID: 39779624
I used the old fashioned way referenced in the document which worked.  But I still wonder why Add New Reference doesn't work.
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 39779860
Hi rickhill11,

before you can use Add New Reference you have to add the DLL's project to the solution. I don't exactly know how this works in VS 2012, in VS 2010 you i.e. can use menu File->Add->Existing Project and select the VCXPROJ file of your DLL's project.

ZOPPO
0
 

Author Comment

by:rickhill11
ID: 39779949
Worked perfectly, Thanks!


Some of the resultant software will be distributed via Dropbox, and I don't want to have to keep track of DLLs on other people's computer.  How can I make a specific project statically link the project that I added via "Add New Reference?"
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 2000 total points
ID: 39779987
Hm - to do this you'll have to change the DLL project's settings to build a static library instead of a DLL.

Usually that's not a big deal. I would suggest to add a configurations like i.e. Release Static (as copy from Release) and Debug Static (as copy from Debug). If you think you won't every need to use the project as a DLL you can skip this, in this case simply ignore these new names below and change the mentioned settings directly in Release and Debug.

In these two new configurations then change the project settings Configuration Properties->General->Configuration Type from Dynamic Library (.dll) to Static Library (.lib).

Further if you really want to only distribute the EXE you should link the runtime (and, if used, MFC too) statically into the EXE too.

To link Runtime Libraries statically set Configuration Properties->C/C++->Code Generation->Runtime Library to Multi-threaded (/MT) in Release Static and Multi-threaded Debug (/MTd) in DebugStatic.

To link MFC statically set Configuration Properties->General->Use of MFC to Use MFC in a Static Library.

At last you may have to configure the new configuration is used in Build->Configuration Manager ... - there simply for the DLL-project select Release Static for the solution's Release configuration and Debug Static for the solution's Debug configuration.

Usually this is enough to linke everything needed into one single EXE. Please take care I only can tell how it is in VS 2010, it maybe some menue items or property names may differ in VS 2012.

Hope this helps,

ZOPPO
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question