Solved

Add reference to an added project

Posted on 2010-11-21
11
297 Views
Last Modified: 2012-05-10
Hi Experts,

I want to use the following downloaded classes in my own project:

https://github.com/moserware/Skills/tree/master/Skills/

I have downloaded them and added the 'Skills' project to my own 'WindowsFormsApplication1'. My IDE is telling me I need to reference the Mouserware.Skills.TrueSkill namespace contained in the downloaded and added Skills project. How do I add this reference when I go to Project | Add Reference | .Net I do not see anything to do with the Skills project listed.
0
Comment
Question by:DColin
  • 4
  • 4
  • 3
11 Comments
 
LVL 3

Expert Comment

by:abdkhlaif
ID: 34182790
in the 'Add Reference' dialog, click 'Browse' tab then choose your dll
more details at:
http://msdn.microsoft.com/en-us/library/ftcwa60a(VS.90).aspx
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34182832
If you have added to the project to your current solution then in the "Add References" dialog switch to the "Projects" tab and add the reference from there.
0
 

Author Comment

by:DColin
ID: 34182995
abdkhlaif:

Neither of the two projects have a dll.

carl_tawn:

When I open the 'Add References' dialogue I do not see any reference to the downloaded and added 'Skills' project. Error
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34183002
Can you post a screen grab of the Add References dialog with the "Projects" tab selected?
0
 
LVL 3

Expert Comment

by:abdkhlaif
ID: 34183051
if you downloaded the source code only, you will need to build the project to generate the dll then add reference to it
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:DColin
ID: 34183123
1 2 3
0
 
LVL 3

Expert Comment

by:abdkhlaif
ID: 34183209
if you downloaded the source code only, you will need to build the project to generate the dll then add reference to it
0
 

Author Comment

by:DColin
ID: 34183233
Hi abdkhlaif

Why is the downloaded project's source code different from my project's source code?
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 34183270
That isn't the "Projects" tab, that's the ".Net" tab. You need to switch the Add Reference to the "Projects" tab, third from the left in your image.

The .Net tab only shows assemblies that are registered in the GAC, which your project isn't. You also don't need to build the project first. When you add a reference to the project it's DLL will be built along side your project and a copy of the resulting DLL will be copied with your project automatically.
0
 
LVL 3

Assisted Solution

by:abdkhlaif
abdkhlaif earned 150 total points
ID: 34183277
there are two ways to use the classes in the Skills project:
1. using the binary (Skills\bin\Release\Moserware.Skills.dll)
in this case you will need to:
- obtain Moserware.Skills.dll either by downloading from github website or by building the Skills project to generate the dll
- then add a reference to the dll in your project

2. using the source code:
in this case you don't need the dll file, but you need to add the class files (*.cs) to your project instead.
For example, to add the 'Guard' class:
- right click your project in the Solution Explorer then click Add -> Existing Item
- browse and select Guard.cs file

in both cases you will need to add:
using Moserware.Skills;
to your code
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 350 total points
ID: 34183297
>>  in this case you don't need the dll file, but you need to add the class files (*.cs) to your project instead.

Erm, no you don't. In fact that is pretty much the last thing you want to be doing.

The class "Skills" project you have added to your solution is already a class library project in itself, which you can reuse across projects. If you add all the class files to your existing Windows Application project then you lose that re-use.

as I have already said, you simply need to add a reference to the class library project; either by building it first and adding a reference to the DLL (in this case there is very little point in keeping Skills in the same solution) or you add a reference to the project (as i have already described) and then it will be built along side your Windows Application project.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now