Solved

Add reference to an added project

Posted on 2010-11-21
11
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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
 

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why use this lambda? 12 65
Get sourcecode path 14 48
Trigger C# code inside the SQL Server 6 36
Fastest way to get file count in MS Server 2012 3 13
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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