Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# 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
v3
Comments
Wes Aday at 21-Jun-12 14:15pm
   
Help with what? You did not bother asking a question or defining what you need help with!
Steve Maier at 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
good
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   
                         (Environment.SpecialFolder.LocalApplicationData);
 
   String DestPath = Path.Combine(localAppData, @"YourCompanyName\YourAppName\");
   DirectoryInfo diSource = new DirectoryInfo(OrigMktDataPath);
   DirectoryInfo diDest = new DirectoryInfo(DestPath);
   try
   {
    if (diSource.Exists)
    {
 
     if (!diDest.Exists)
     {
      Directory.CreateDirectory(destPath);
     }
     bool OverWrite = false;
     CopyDir(OrigMktDataPath, DestPath, OverWrite);
    }
   }
   catch (Exception ex)
   {
    regWrap.WriteLogException(ex);
    regWrap.FlushFileStream();
   }
}
 
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);
  }
 }
}
 
  Permalink  
v2
Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 400
1 Jochen Arndt 190
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,032
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,220


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 21 Jun 2012
Copyright © CodeProject, 1999-2014
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