simple question: Web setup project installer. changing installation directory

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MENTAT

    #1

    simple question: Web setup project installer. changing installation directory

    Hi,

    I am trying to create an installer for my web application. So I added a
    web setup project to my solution (I am using VS.NET 2003). Been playing
    around with it since then and it basically works.

    Now, I am wondering if there is any way to change the directory that
    the installer installs the files to. I want to be able to put my files
    in a specified directory (user specified is good, but i don't mind
    hardcoding the path either) and point my virtual directory to it.

    Is there any way to do this. Right now the files are just being stored
    in c:\...\inetput\ wwwroot\Project FileName directory. I opened up the
    File system editor and looked at the properties for the WebApplication
    Folder. One of the properties is called property TARGETDIR. I assume
    this is the property i need to change?
    [color=blue]
    >From what I gathered on the web and newsgroups, this property can be[/color]
    accessed "programaticall y". Is this correct? Can anyone tell me me how
    to access and set this property. As I said, Ideally I would like to
    give the user the option of specifying the physical directory, but i
    don't mind hardcoding that during design time either.

  • MENTAT

    #2
    Re: simple question: Web setup project installer. changing installatio

    Thanks for the reply Kannan,

    Yes, the articles have helped. But from what i gather the CustomAction
    is executed after the installation. By this time the directory
    structure has already been created. (Isn't that correct?)

    Is there any way to programmaticall y create virtual directories. I.e
    create and ordinary directory structure and point a virtual directory
    to it. There are some code snippets for this floating around, but they
    are all written in VB, not C#. I haven't found one in C# yet. Is the
    only way to create virtual directories and configure IIS to use VB? (If
    so, I might have to start learning to code in VB). Or is there a c#
    option?

    I read somewhere that the solution to this is to use an ordinary setup
    project (not a web setup) and create the directory structure, and then
    point the virtual directory to it. Is this really the best way to do
    things or is there a web setup solution?

    How do I get CustomAction to execute before the installation. In the
    installer class there is a BeforeInstall event. Is this what I have to
    use create my virtual directory programmaticall y (if that is the way to
    go).

    There seems to be a lot of bits and pieces around and related sequence
    tasks to be done. So far I haven't found a good comprehensive solution.
    Surely someone out there has already done this before? Just need a bit
    more help piecing the puzzle together.

    Thanks all in advance.


    PS: I haven't been able to access Context.Paramet ers["INSTALLDIR "] so
    far. Keeps throwing an "object reference not set to an object instance"
    error during installation. And from what I gather, this is a property
    that is set by the installer after installation. Not something the
    CustomAction can set before installation. Am I correct?


    Kannan.V [MCSD.net] wrote:[color=blue]
    > hi....
    >
    > for reading the values from the install program, i guess u must have[/color]
    added[color=blue]
    > custom forms to ur install app from the setup project, in this case u[/color]
    have to[color=blue]
    > create a custom installer class to read the values from the installer[/color]
    [color=blue]
    > application and do the required job, once u have created ur installer[/color]
    class u[color=blue]
    > need to add this dll file as a custom action to the installer,
    > so when the installer runs, the code in the installer class also gets[/color]
    [color=blue]
    > executed.
    >
    > you need to pass the parameters thro the custom action data property[/color]
    in the[color=blue]
    > setup app.
    > Ex. - /INSTALLDIR="[INSTALLDIR]"
    > and inside the installer class you can read the parameters as shown[/color]
    below.[color=blue]
    > Console.WriteLi ne(Context.Para meters["INSTALLDIR "].ToString());
    >
    > check out these links for further reading.
    > http://www.c-sharpcorner.com/Code/20...nstClasses.asp
    >
    >[/color]
    http://msdn.microsoft.com/library/de...classtopic.asp[color=blue]
    >
    > hope this helps,
    > Bye
    >
    > Kannan.V
    > http://kannanv.blogspot.com
    >
    >
    >
    > "MENTAT" wrote:
    >[color=green]
    > > Hi,
    > >
    > > I am trying to create an installer for my web application. So I[/color][/color]
    added a[color=blue][color=green]
    > > web setup project to my solution (I am using VS.NET 2003). Been[/color][/color]
    playing[color=blue][color=green]
    > > around with it since then and it basically works.
    > >
    > > Now, I am wondering if there is any way to change the directory[/color][/color]
    that[color=blue][color=green]
    > > the installer installs the files to. I want to be able to put my[/color][/color]
    files[color=blue][color=green]
    > > in a specified directory (user specified is good, but i don't mind
    > > hardcoding the path either) and point my virtual directory to it.
    > >
    > > Is there any way to do this. Right now the files are just being[/color][/color]
    stored[color=blue][color=green]
    > > in c:\...\inetput\ wwwroot\Project FileName directory. I opened up[/color][/color]
    the[color=blue][color=green]
    > > File system editor and looked at the properties for the[/color][/color]
    WebApplication[color=blue][color=green]
    > > Folder. One of the properties is called property TARGETDIR. I[/color][/color]
    assume[color=blue][color=green]
    > > this is the property i need to change?
    > >[color=darkred]
    > > >From what I gathered on the web and newsgroups, this property can[/color][/color][/color]
    be[color=blue][color=green]
    > > accessed "programaticall y". Is this correct? Can anyone tell me me[/color][/color]
    how[color=blue][color=green]
    > > to access and set this property. As I said, Ideally I would like to
    > > give the user the option of specifying the physical directory, but[/color][/color]
    i[color=blue][color=green]
    > > don't mind hardcoding that during design time either.
    > >
    > >[/color][/color]

    Comment

    • Kannan.V [MCSD.net]

      #3
      Re: simple question: Web setup project installer. changing install

      hi MENTAT,

      As you have said the directory structure for the web setup projects are
      created at the start of the install process, tried to play around with it,
      but was not able to get a way to manipulate it.

      You can programatically create directories and point to a virtual directory.
      and there is no difference in using VB or C#, you must be able to do
      whatever you do in VB using C#, the only difference is the syntax and a
      little bit of the way they both handle things, but thats got nothing to do
      with the coding or the logic part.

      Yes we can use the Ordinary setup project to create folders and point to the
      virtual directory.

      Will post with more info once try something on my box.

      PS : For websetup projects use the ["TARGETDIR"] as the parameter.

      "MENTAT" wrote:
      [color=blue]
      > Thanks for the reply Kannan,
      >
      > Yes, the articles have helped. But from what i gather the CustomAction
      > is executed after the installation. By this time the directory
      > structure has already been created. (Isn't that correct?)
      >
      > Is there any way to programmaticall y create virtual directories. I.e
      > create and ordinary directory structure and point a virtual directory
      > to it. There are some code snippets for this floating around, but they
      > are all written in VB, not C#. I haven't found one in C# yet. Is the
      > only way to create virtual directories and configure IIS to use VB? (If
      > so, I might have to start learning to code in VB). Or is there a c#
      > option?
      >
      > I read somewhere that the solution to this is to use an ordinary setup
      > project (not a web setup) and create the directory structure, and then
      > point the virtual directory to it. Is this really the best way to do
      > things or is there a web setup solution?
      >
      > How do I get CustomAction to execute before the installation. In the
      > installer class there is a BeforeInstall event. Is this what I have to
      > use create my virtual directory programmaticall y (if that is the way to
      > go).
      >
      > There seems to be a lot of bits and pieces around and related sequence
      > tasks to be done. So far I haven't found a good comprehensive solution.
      > Surely someone out there has already done this before? Just need a bit
      > more help piecing the puzzle together.
      >
      > Thanks all in advance.
      >
      >
      > PS: I haven't been able to access Context.Paramet ers["INSTALLDIR "] so
      > far. Keeps throwing an "object reference not set to an object instance"
      > error during installation. And from what I gather, this is a property
      > that is set by the installer after installation. Not something the
      > CustomAction can set before installation. Am I correct?
      >
      >
      > Kannan.V [MCSD.net] wrote:[color=green]
      > > hi....
      > >
      > > for reading the values from the install program, i guess u must have[/color]
      > added[color=green]
      > > custom forms to ur install app from the setup project, in this case u[/color]
      > have to[color=green]
      > > create a custom installer class to read the values from the installer[/color]
      >[color=green]
      > > application and do the required job, once u have created ur installer[/color]
      > class u[color=green]
      > > need to add this dll file as a custom action to the installer,
      > > so when the installer runs, the code in the installer class also gets[/color]
      >[color=green]
      > > executed.
      > >
      > > you need to pass the parameters thro the custom action data property[/color]
      > in the[color=green]
      > > setup app.
      > > Ex. - /INSTALLDIR="[INSTALLDIR]"
      > > and inside the installer class you can read the parameters as shown[/color]
      > below.[color=green]
      > > Console.WriteLi ne(Context.Para meters["INSTALLDIR "].ToString());
      > >
      > > check out these links for further reading.
      > > http://www.c-sharpcorner.com/Code/20...nstClasses.asp
      > >
      > >[/color]
      > http://msdn.microsoft.com/library/de...classtopic.asp[color=green]
      > >
      > > hope this helps,
      > > Bye
      > >
      > > Kannan.V
      > > http://kannanv.blogspot.com
      > >
      > >
      > >
      > > "MENTAT" wrote:
      > >[color=darkred]
      > > > Hi,
      > > >
      > > > I am trying to create an installer for my web application. So I[/color][/color]
      > added a[color=green][color=darkred]
      > > > web setup project to my solution (I am using VS.NET 2003). Been[/color][/color]
      > playing[color=green][color=darkred]
      > > > around with it since then and it basically works.
      > > >
      > > > Now, I am wondering if there is any way to change the directory[/color][/color]
      > that[color=green][color=darkred]
      > > > the installer installs the files to. I want to be able to put my[/color][/color]
      > files[color=green][color=darkred]
      > > > in a specified directory (user specified is good, but i don't mind
      > > > hardcoding the path either) and point my virtual directory to it.
      > > >
      > > > Is there any way to do this. Right now the files are just being[/color][/color]
      > stored[color=green][color=darkred]
      > > > in c:\...\inetput\ wwwroot\Project FileName directory. I opened up[/color][/color]
      > the[color=green][color=darkred]
      > > > File system editor and looked at the properties for the[/color][/color]
      > WebApplication[color=green][color=darkred]
      > > > Folder. One of the properties is called property TARGETDIR. I[/color][/color]
      > assume[color=green][color=darkred]
      > > > this is the property i need to change?
      > > >
      > > > >From what I gathered on the web and newsgroups, this property can[/color][/color]
      > be[color=green][color=darkred]
      > > > accessed "programaticall y". Is this correct? Can anyone tell me me[/color][/color]
      > how[color=green][color=darkred]
      > > > to access and set this property. As I said, Ideally I would like to
      > > > give the user the option of specifying the physical directory, but[/color][/color]
      > i[color=green][color=darkred]
      > > > don't mind hardcoding that during design time either.
      > > >
      > > >[/color][/color]
      >
      >[/color]

      Comment

      Working...