Visual C# question
-
Using the standalone version of visual C# .NET: I'm writing a game. In my solution workspace I have 2 projects - the actual game and the map editor. I want the two to be able to share classes (as in code - not run time instances). That is if I write a class in the game project I want to be able to use it in the map editor. Im kind of new to C#, coming from java and c++. In java I would just jar the classes I wanted at compile time and put them in my classpath. How can I do this in visual C#? I think I need to make a .NET assembly, but Im really not sure how to do that. Thanks for any help Dave Ratti
-
Using the standalone version of visual C# .NET: I'm writing a game. In my solution workspace I have 2 projects - the actual game and the map editor. I want the two to be able to share classes (as in code - not run time instances). That is if I write a class in the game project I want to be able to use it in the map editor. Im kind of new to C#, coming from java and c++. In java I would just jar the classes I wanted at compile time and put them in my classpath. How can I do this in visual C#? I think I need to make a .NET assembly, but Im really not sure how to do that. Thanks for any help Dave Ratti
dratti wrote: How can I do this in visual C#? I think I need to make a .NET assembly, but Im really not sure how to do that. AFAIK the standard version does not have that wizard, but just create a new windows form or console app, and remove the main method, and change the project property to compile to Class Library.
-
dratti wrote: How can I do this in visual C#? I think I need to make a .NET assembly, but Im really not sure how to do that. AFAIK the standard version does not have that wizard, but just create a new windows form or console app, and remove the main method, and change the project property to compile to Class Library.
-
Using the standalone version of visual C# .NET: I'm writing a game. In my solution workspace I have 2 projects - the actual game and the map editor. I want the two to be able to share classes (as in code - not run time instances). That is if I write a class in the game project I want to be able to use it in the map editor. Im kind of new to C#, coming from java and c++. In java I would just jar the classes I wanted at compile time and put them in my classpath. How can I do this in visual C#? I think I need to make a .NET assembly, but Im really not sure how to do that. Thanks for any help Dave Ratti
You can make a dll library that holds the shared classes and you can access those classes from any project you want by including a reference to that dll project. To add such a project to your solution right click the solution in the Solution Explorer and select Add --> New Project and select Class Library and create a new project somewhere. Then to add references to that library and to make dependencies right click on the projects you want to set the dependency on and click dependencies. Then click the checkbox in front of the dll library and it automatically adds references to that poject and you can use those classes that you put in the dll library by just adding a: #using dllNamespace directive in the files you want to use it.