10 Replies - 875 Views - Last Post: 04 September 2009 - 06:38 PM Rate Topic: -----

#1 reCoded  Icon User is offline

  • D.I.C Regular

Reputation: 6
  • View blog
  • Posts: 282
  • Joined: 25-February 08

DLL Issue

Posted 26 August 2009 - 02:58 PM

I have a project and I want to create a .dll from that project so I can use it in a different project.

I want to be able to do

using MyApp.Proxies;

Can someone help?
Is This A Good Question/Topic? 0
  • +

Replies To: DLL Issue

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6063
  • View blog
  • Posts: 23,515
  • Joined: 23-August 08

Re: DLL Issue

Posted 26 August 2009 - 03:15 PM

Change the project to be a ClassLibrary DLL with a Default Namespace of Proxies.
Was This Post Helpful? 0
  • +
  • -

#3 mager1794  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 133
  • Joined: 23-March 09

Re: DLL Issue

Posted 26 August 2009 - 05:37 PM

Technically the namespace would need to be MyApp.Proxies

but unless your doing multiple dll files using the preceding MyApp
just name it proxies
Was This Post Helpful? 0
  • +
  • -

#4 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: DLL Issue

Posted 27 August 2009 - 12:25 AM

Basically, you need to create a new DLL project with functionalities inherited from the main project. The code structure in your DLL project should be like this:

namespace MyApp
{
	public class Proxies
	{
		// This could be another subclass
		public class AnotherSubClass
		{

		}

	}

}


Was This Post Helpful? 0
  • +
  • -

#5 reCoded  Icon User is offline

  • D.I.C Regular

Reputation: 6
  • View blog
  • Posts: 282
  • Joined: 25-February 08

Re: DLL Issue

Posted 27 August 2009 - 05:11 AM

I went into the 'bin' folder and there was a .DLL for the project I was working on. I referenced that in my project and it seems to work. Is that the way you can reference your project in another project?
Was This Post Helpful? 0
  • +
  • -

#6 Aeternalis  Icon User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 291
  • Joined: 13-July 09

Re: DLL Issue

Posted 27 August 2009 - 05:25 AM

You can reference any DLL for use in your projects. ( COM and .NET interop issues aside) Just add it to the project references. You don't need the DLL's sourcecode in order to reference the DLL.

Now if you do have a project you want to use in another project, but no DLL.. you have to compile the project into a DLL as stated by JackOfAllTrades then reference it in the project you want to use it in just as before.

This is ultimately where you want to be for reusable code, creating DLL's that can be used and re-used by all your applications.

Aet
Was This Post Helpful? 0
  • +
  • -

#7 reCoded  Icon User is offline

  • D.I.C Regular

Reputation: 6
  • View blog
  • Posts: 282
  • Joined: 25-February 08

Re: DLL Issue

Posted 27 August 2009 - 12:24 PM

So the way I have referenced a project in another project is not the right way of doing it? Taking the .dll file frome the bin folder of the project I want to reference?
Was This Post Helpful? 0
  • +
  • -

#8 Aeternalis  Icon User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 291
  • Joined: 13-July 09

Re: DLL Issue

Posted 27 August 2009 - 01:04 PM

View PostreCoded, on 27 Aug, 2009 - 11:24 AM, said:

So the way I have referenced a project in another project is not the right way of doing it? Taking the .dll file frome the bin folder of the project I want to reference?


Its not wrong .. all that is happening there is that you have two projects hosted by the same solution. One Project is a DLL and will compile into a DLL. The other is an executable and references the DLL the other project creates. That's pretty much standard if you are developing the DLL and the EXE concurrently. It makes it much easier to see the updates to your DLL if you have it compile directly into the directory where the EXE is expecting it to be, then you can just build the solution and run the exe to debug the DLL.

Hope Im not just clouding the issue here..
Good Luck

Aet
Was This Post Helpful? 0
  • +
  • -

#9 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 526
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: DLL Issue

Posted 04 September 2009 - 05:09 AM

View PostreCoded, on 27 Aug, 2009 - 11:24 AM, said:

So the way I have referenced a project in another project is not the right way of doing it? Taking the .dll file frome the bin folder of the project I want to reference?


I have a small bit of information on this.

Since you have the project, you should add this project to your main solution. After you've done that, add reference on your main project, BUT add it as a project reference.

The reason I say to do this is because once your applications get more complex, and you're always just including the binary references, your dependency tree could be incorrectly formed and as such will require multiple compilations in order to get all required references compiled.

When you add project reference, VS actually figures out the correct dependency tree and (if done right) will only require a single compilation to build the whole thing.

Of course this probably won't matter in this app you're building, but it's definitely good knowledge to just tuck away in your mind.

Hopefully this helps.
Was This Post Helpful? 0
  • +
  • -

#10 programmer2u  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 17
  • Joined: 01-May 09

Re: DLL Issue

Posted 04 September 2009 - 06:29 PM

[

Quote

Hi I read your discussion about calling one project to other using first project's Dll.
so, what about the DLL whose codes are unknown to us but we know the physical working of its exe , how we can see or hack that dll to see what classes inside it and what methods or function it have?

Please reply...ASAP.

Thanks.

Was This Post Helpful? 0
  • +
  • -

#11 MentalFloss  Icon User is offline

  • "ADDICTED"[2:5]
  • member icon

Reputation: 526
  • View blog
  • Posts: 1,397
  • Joined: 02-September 09

Re: DLL Issue

Posted 04 September 2009 - 06:38 PM

Quote

Hi I read your discussion about calling one project to other using first project's Dll.
so, what about the DLL whose codes are unknown to us but we know the physical working of its exe , how we can see or hack that dll to see what classes inside it and what methods or function it have?

Please reply...ASAP.

Thanks.


If you don't have the code, you simply add it as a reference by browsing to the binary.

Once it's referenced, you can right-click it and "view in object browser". This will show you the overall structure of the binary.

You can go even deeper than that and look at the actual code via reflector. However, it's probably not going to be needed unless there is zero support for your required dll.

This post has been edited by MentalFloss: 04 September 2009 - 06:38 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1