Hi
When I was about to publish my project it asked me to specify the location. I gave the location C:\Program Files\myproject\bin but it failed to publish since there is no folder called myproject inside the Program Files folder. But in a forum I found that for that we should use an API which performs the required info. But I dont know that API and how to use in project inorder to publish that in the location I need.
Thanks
Loading
Kirtan PatelPosted Aug 4, 2009, 3:05 AM
using System.Runtime.InterdropServices;
[DllImport("kernel32.dll")]
static extern bool CreateDirectory(string lpPathName,IntPtr lpSecurityAttributes);
private void button1_Click(object sender, EventArgs e)
{
CreateDirectory(@"C:\Users\Kirtan\Desktop\TestFolder",IntPtr.Zero);
}
You can Use this API Function for Creating Directory
but as per your need you need to create Directory when you Install Your Software
I recommend that you use SetupProject to Build the Setup That will Provide Options Where to Publish the Exe(s) and Create Directory Automatically
Kirtan PatelPosted Aug 4, 2009, 3:54 PM
If you don't have Visual Studio Professional Edition
then the simplest Solution is Use Winrar SFX archive to create Self Extracting exe that Will Extract your Files to Specified Folder but it will not as programmable as the Setup project but if you just want to extract files then it will be great as also let you choose the path where to extract.
You can use Freeware Setup Creators but they are not so easy to use as the One that is in Visual Studio
Inno Setup
http://www.jrsoftware.org/isinfo.php
NSIS
Nullsoft Install System (Scriptable)
and If you can Buy a Software then Best one is http://www.indigorose.com/products/setup-factory/
its very easy to use and Also Better than that Visual Studio Setup
Hope it Will be useful to you .
sachi vasishtaPosted Aug 4, 2009, 2:56 PM
File > New > Project > Other Project types > Setup And Deployment > Setup project
In 2008 exp edition in order to deploy we have the option publish which can be seen by right clicking on the project in the solution explorer and it asks to choose the location and I gave the path as C:\program files\myproject\bin but it failed to create as there is no folder called myproject in the program files folder. If you find any solution plz reply.Thank you
Kirtan PatelPosted Aug 4, 2009, 5:06 AM
File > New > Project > Other Project types > Setup And Deployment > Setup project
Add All Your exe(s) and Dll and other Filse in
Application Folder
Create Short Cut "User 's Program menu "
This Compiled Setup will provide you to choose folder Where to Install Application and According to That Create Fodlers :)
sachi vasishtaPosted Aug 4, 2009, 3:43 AM
kirtan as you told I want to create the folder myproject inside the program files folder at the time of installation but I dont know how to use SetupProject to Build the Setup that will Provide Options Where to Publish the Exe(s) and Create Directory Automatically.
Kirtan and one more thing I "published" one windows forms project,which creates the setup file ,in that when I double clicked the setup file it asked me to install the application But I want the application to ask me the location where it is going to instal when I double click on this setup file. I am using Visual C# express edition 2008 exp edition