Click here to Skip to main content
11,929,675 members (55,657 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Visual-Studio VS2010
I need help to create an install (preferably creating a MSI) using vs2010 for some c# applications that use SQL EXpress mdfs. I have tried the click once, but that does not meet my needs.The SQL Express mdfs that I need installed must be placed in the "C:\Program Files\'Company'" directory, or another static directory, so the apps can read and write to these mdfs. The applications can be there as well, or in a sub-directory. I have multiple small apps that share the same mdfs, so they should be installed either in the same directory or in a sub-directory.

This install should install the same folders in XP, Vista, Win7 and Win8 when it is available.

I need to do this using the provided tools in VS2010 Ultimate. I can use any tool if it is free and I can get help.

The install is for stand alone PCs in small offices.

Please help.
Posted 21-Jun-12 8:38am
Edited 21-Jun-12 9:25am
Wes Aday 21-Jun-12 14:15pm
Help with what? You did not bother asking a question or defining what you need help with!
Steve Maier 21-Jun-12 14:23pm
So your installer has to just be with VS2010? Can't you use WiX, InnoSetup, or NSIS? All of those are free.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I wrote a ClickOnce Application with similar problems. I overcame those problems and even figured out how to email an activation key once the software was paid for.

By having your App use the windows registry you can test to see if this is the first time the App is being run.

void OnFirstRun()
   // get directory of datafiles downloaded with the App, this is 
   // an unusual and very long ClickOnce path.
   String StartupPath = System.Windows.Forms.Application.StartupPath;
   String OrigMktDataPath = Path.Combine(StartupPath, "MktData");
   // get destination path
   String localAppData = Environment.GetFolderPath   
   String DestPath = Path.Combine(localAppData, @"YourCompanyName\YourAppName\");
   DirectoryInfo diSource = new DirectoryInfo(OrigMktDataPath);
   DirectoryInfo diDest = new DirectoryInfo(DestPath);
    if (diSource.Exists)
     if (!diDest.Exists)
     bool OverWrite = false;
     CopyDir(OrigMktDataPath, DestPath, OverWrite);
   catch (Exception ex)
private void CopyDir(String PathSrc, String PathDest, bool OverWrite)
 DirectoryInfo diSource = new DirectoryInfo(PathSrc);
 FileInfo[] files = diSource.GetFiles();
 String DestFFN;
 foreach (FileInfo fi in files)
  DestFFN = PathDest + fi.Name;
  if (!File.Exists(DestFFN) || OverWrite)
   fi.CopyTo(DestFFN, true);
   File.SetAttributes(DestFFN, FileAttributes.Normal);
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If ClickOnce will not work for you and you want to use Visual Studio 2010, then you need to research a setup project.

Here[^] is an MSDN article about creating one.

Here[^] is a google search that may help you find more information.

Use these to start working on your project, then when you get stuck with a more specific question come back here and post your question.

Hope this helps.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 21 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100