Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Helloo


I finally finished my project .. but i need to do a setup project for my application ,i searched on how to do this ..but the application didn't work.. someone i asked told me that in my application i can't do the simple setup that i found
My application contains 3 games and a profile.
the project tree is like the following:

Project 1 (game 1) (WinForm)
Project 2 (game 2) (WinForm)
Project 3 (game 3) (WPF)
Main Project (Profile)(WPF)

the 3 projects are linked to the main one
In each project, when the user finishes a game, an Xml file is written from the "project i" in the Debug folder of the main project (i=1/2 or 3) using the path
..\\..\\..\\MainProject\\..etc

Plus I'm using music and photos in each project
And i want to put an image for the game.


thanks in advance
Posted

When you release your program - which is what a setup program is all about, after all - you won't have a debug folder! If noithing else, you should be releasing the Release version which is generally smaller, faster and contains better optimised code and no debug information.

So, no debug folder - which means you would be trying to write to a folder under your application, which will have been installed in the "Program Files" (or "Program Files x86") folder. The trouble with that is that it really isn't a good idea to keep data files of any sort there - if nothing else, changes here are restricted to admin (win 7) or seen as virus activity.

Instead, use
C#
string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

and check if it contains a folder for your application. If it does, use it.
If it doesn't, create it and use it.

After that, it is a simple matter to make a setup program - you just have to add a Setup and Deployment Project to your solution and follow the instructions, pretty much.
 
Share this answer
 
Comments
Member 8403770 9-Mar-12 15:24pm    
where do i put this code? and for what?
OriginalGriff 9-Mar-12 15:41pm    
When you execute that code, it returns the path to a "Special Folder" which is user related, and can be written to and read from safely - it is under the user Documents, rather than under Programs so it requires no special permissions or access.
So you can create a folder under this to store your app documents safely.

As to where to put the code, I would suggest in a method called "GetDataStorePath" or similar and have it check for you app folder and create as necessary. You can then call it when you want to read or write data.
Member 8403770 10-Mar-12 18:42pm    
ty :)
Possibly the easiest way for you to solve your problem is to create a Visual Studio Installer Project. This allows you to just choose the output of the projects and include them in a single installer.

You can find more details here[^]. Even though this is for VS 2005, you can use the same process in VS 2008 and VS 2010.
 
Share this answer
 
Comments
Member 8403770 9-Mar-12 15:22pm    
I'm not getting a successful result :S

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900