By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

Detecting install folder during installation

P: n/a
Hi,

I have created a .NET deployment project in Visual Studio 2003. I have
specified an entry point into my own code in this installer which launches
into the familiar:

public override void Install(IDictionary savedState)
{
Application.Run(new MyForm());
base.Install(savedState);
}

That's the background and everything works swimmingly - one thing I cannot
find anywhere is how to get the installation location at this point, for
instance if the user chooses to install to the E: drive or similiar during
the install process, how would you then find the path the user chose?

The reason I want this path is because this application is a visual studio
add-in and thus can't use System.IO.Directory.GetCurrentDirectory() later on,
yet I want to allow the user to choose where the files it uses should be
installed and be able to access those.

Any help is kindly appreciated,

Chad Smith.
Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Pass TARGETDIR into the custom action like this:
http://msdn.microsoft.com/library/de...taproperty.asp

You might get some unusual things happening because what you're doing is not
supposed to be done. The architecture of MSI setups is that there is a UI
sequence and then a silent sequence running on top of the MSI Service. You
shouldn't be showing UI like this, and it might be safer to launch your app
rather than have it run on top of the MSI Service.
System.IO.GetCurrentDirectory() is just one of those things that won't be
what you expected. Do any of your users expect to be able to do a silent
install?
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

"Chad Smith" <ch***@burning-ice.co.uk> wrote in message
news:dk**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Hi,

I have created a .NET deployment project in Visual Studio 2003. I have
specified an entry point into my own code in this installer which launches
into the familiar:

public override void Install(IDictionary savedState)
{
Application.Run(new MyForm());
base.Install(savedState);
}

That's the background and everything works swimmingly - one thing I cannot
find anywhere is how to get the installation location at this point, for
instance if the user chooses to install to the E: drive or similiar during
the install process, how would you then find the path the user chose?

The reason I want this path is because this application is a visual studio
add-in and thus can't use System.IO.Directory.GetCurrentDirectory() later
on,
yet I want to allow the user to choose where the files it uses should be
installed and be able to access those.

Any help is kindly appreciated,

Chad Smith.

Nov 22 '05 #2

P: n/a
Thank you for your reply, I'll test that now.

Users won't be running a silent install at this stage but thanks for the
pointer, I'll keep this in mind.

This goes off topic but as you mentioned it, and if you wouldn't mind helping
further; what is the .net best practice for actually launching an app from
inside a component such as this?

Many thanks again,

Chad.

On 10/11/2005 15:07:37, "Phil Wilson" wrote:
Pass TARGETDIR into the custom action like this:
http://msdn.microsoft.com/library/de...taproperty.asp

You might get some unusual things happening because what you're doing is not
supposed to be done. The architecture of MSI setups is that there is a UI
sequence and then a silent sequence running on top of the MSI Service. You
shouldn't be showing UI like this, and it might be safer to launch your app
rather than have it run on top of the MSI Service.
System.IO.GetCurrentDirectory() is just one of those things that won't be
what you expected. Do any of your users expect to be able to do a silent
install?
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

"Chad Smith" <ch***@burning-ice.co.uk> wrote in message
news:dk**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Hi,

I have created a .NET deployment project in Visual Studio 2003. I have
specified an entry point into my own code in this installer which launches
into the familiar:

public override void Install(IDictionary savedState)
{
Application.Run(new MyForm());
base.Install(savedState);
}

That's the background and everything works swimmingly - one thing I cannot
find anywhere is how to get the installation location at this point, for
instance if the user chooses to install to the E: drive or similiar during
the install process, how would you then find the path the user chose?

The reason I want this path is because this application is a visual studio
add-in and thus can't use System.IO.Directory.GetCurrentDirectory() later
on,
yet I want to allow the user to choose where the files it uses should be
installed and be able to access those.

Any help is kindly appreciated,

Chad Smith.



Nov 22 '05 #3

P: n/a
It depends what your app code does. If it collects data from the user, that
should be happening in the UI sequence up front. That data typically gets
stored in properties that you define (like [TARGETDIR] is a built-in
property). If there are default values for the properties you can specify
them with a command line install:

msiexec /i <path to msi> MYPROPERTY=something

or just put the defaults in the Property table in the MSI (no VS support for
that). If you just want to run your app, it's common to trigger it off the
Finish button when you get the final dialog (no VS support for that) if
there's always a user interface. If the install is always quiet (there's a
UILevel property to tell you whether it is or not) you can just run an
executable rather than have your app running on top of the MSI Service.
Since you mentioned .NET best practice, I'll add that none of this .NET -
Windows Installer has been around since before .NET, but since VS .NET
started offering setup projects many people think that VS .NET setup
projects and Windows Installer are somehow the same thing.

--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

"Chad Smith" <ch***@burning-ice.co.uk> wrote in message
news:dk**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Thank you for your reply, I'll test that now.

Users won't be running a silent install at this stage but thanks for the
pointer, I'll keep this in mind.

This goes off topic but as you mentioned it, and if you wouldn't mind
helping
further; what is the .net best practice for actually launching an app from
inside a component such as this?

Many thanks again,

Chad.

On 10/11/2005 15:07:37, "Phil Wilson" wrote:
Pass TARGETDIR into the custom action like this:
http://msdn.microsoft.com/library/de...taproperty.asp

You might get some unusual things happening because what you're doing is
not
supposed to be done. The architecture of MSI setups is that there is a UI
sequence and then a silent sequence running on top of the MSI Service. You
shouldn't be showing UI like this, and it might be safer to launch your
app
rather than have it run on top of the MSI Service.
System.IO.GetCurrentDirectory() is just one of those things that won't be
what you expected. Do any of your users expect to be able to do a silent
install?
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.html?bID=280

"Chad Smith" <ch***@burning-ice.co.uk> wrote in message
news:dk**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Hi,

I have created a .NET deployment project in Visual Studio 2003. I have
specified an entry point into my own code in this installer which
launches
into the familiar:

public override void Install(IDictionary savedState)
{
Application.Run(new MyForm());
base.Install(savedState);
}

That's the background and everything works swimmingly - one thing I
cannot
find anywhere is how to get the installation location at this point, for
instance if the user chooses to install to the E: drive or similiar
during
the install process, how would you then find the path the user chose?

The reason I want this path is because this application is a visual
studio
add-in and thus can't use System.IO.Directory.GetCurrentDirectory()
later
on,
yet I want to allow the user to choose where the files it uses should be
installed and be able to access those.

Any help is kindly appreciated,

Chad Smith.


Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.