Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have downloaded an open source project that I intend to use with my current game. The download came with all the class files from the original project as well as a pre-compiled DLL file representing the project. I was able to easily link this DLL with my current project and get it working just fine, no problems there.

The problem I now have is that I want to make a couple of changes to the original libraries (extend its functionality a bit to better suit my needs) and re-export the class library as a DLL again, but I have no clue how to do this. Is there some simple way in VS where I can just take the class library and export/compile it as a DLL file again or is there more to it than that?

This seems like something that should be pretty simple but my efforts to find an answer have so far come up with nothing.

Thanks in advance.

share|improve this question

closed as off-topic by Josh Petrie Nov 11 '14 at 17:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions that aren't specific to game development are off-topic here, but can be asked on Stack Overflow. A good rule of thumb is to ask yourself "would a professional game developer give me a better/different/more specific answer to this question than other programmers?"" – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 3 down vote accepted

If you have the solution file:

In the "Solution Explorer"

Simply add right click the "Solution 'Name'", Select Add -> Existing Project -> And locate the .vsproj or .sln file.

Then, when the project is added. Add a reference by right clicking the project that will use the library. Select Add Reference, "Projects" and select the Project from the list.

If you have a .dll file:

Create a new Class Library, add a reference to the .dll file by right clicking the Class Library Project, "Add Reference" -> Browse to the .dll file.

Whenever you wish to extend or use a functionality, inherit the methods in the .dll file and implement your own methods or create a new method and use the methods in the Namespace (of the .dll file you just referenced)

Then, add a reference to the Class Library the same way as you did earlier (if you had solution) to your main project.


When you compile your main project, if you included a dll file both .dll files will be compiled to the project output directory bin\x86 for example. If you imported the whole solution, only one .dll file will be in the bin\x86 directory.

share|improve this answer

Deukalion explains it very well. Appolgoes if you already know this, but you were saying that you couldn't find any sources of information...

The problem you are describing is one of the principles of object orientated design called the Open / Closed principle. One of the 5 basic principles of SOLID.

If you're looking to read more on it, here might be a good starting point :

The Open / Closed principle is also known sometimes as 'Open for extension, Closed for modification'.

So you essentially don't want to modify the original source code, just extend it and build your own extended library to use in your project.

share|improve this answer

Did said open source project come with a VS project file (*.csproj) or a solution? If so, open and compile. If not you could just start your own class library project and add the class files.

share|improve this answer
Please give more details. This doesn't seem to actually answer the question. – Ricket Dec 13 '12 at 16:52
Please give more details. Your comment doesn't seem to actually explain your downvote. Just because I didn't spell it out babystep by babystep doesn't mean it's not a valid answer – indeed005 Dec 13 '12 at 21:35
I was only responding to a flag. The definition of a downvote is "this answer is not useful". His question was how to compile a DLL and you have answered it by telling him to open and compile it. I guess it's valid in some sense, but I would agree that it's not useful/helpful to the author. If you put yourself in his shoes and then read your answer, do you think it answers his questions? Regardless, it's up to the community and original author to decide what's a good answer by voting, I was merely giving a suggestion. – Ricket Dec 14 '12 at 16:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.