[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Vivek Thakur

3/31/2006 3:42:00 PM

hi,

i have a setup project and have a custom install class where i have this
method wich tries to find a file named X.txt which is in the same folder as
the current msi (wich i double clicked).

now i want to copy this X.txt to a location in C:\. For that i created the
custom install action class and wrote a method, but i cant access the current
directory if i use application.path or other methods to get the current
directory. it always give me c:\windows\system32, which i think is logical as
my setup calls msiexec.exe which is in the windows\system32 folder.

is there any way to know where my msi exe is?
--
Vivek Thakur (MCP)
www.vivekthakur.com
7 Answers

Phil Wilson

4/1/2006 10:04:00 PM

0

If you've installed the file in the application folder in the setup project,
this is identified by the TARGETDIR property. So pass [TARGETDIR] into your
custom action (via CustomActionData) and it will be the path to your
directory.
--
Phil Wilson
[Microsoft MVP-Windows Installer]
Definitive Guide to Windows Installer
http://apress.com/book/bookDisplay.ht...

"Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
news:6674A6D8-893C-4D44-89FA-A1E735513E3D@microsoft.com...
> hi,
>
> i have a setup project and have a custom install class where i have this
> method wich tries to find a file named X.txt which is in the same folder
> as
> the current msi (wich i double clicked).
>
> now i want to copy this X.txt to a location in C:\. For that i created the
> custom install action class and wrote a method, but i cant access the
> current
> directory if i use application.path or other methods to get the current
> directory. it always give me c:\windows\system32, which i think is logical
> as
> my setup calls msiexec.exe which is in the windows\system32 folder.
>
> is there any way to know where my msi exe is?
> --
> Vivek Thakur (MCP)
> www.vivekthakur.com


Vivek Thakur

4/3/2006 8:02:00 AM

0

Phil,

thanks for yr response, but i cant use targetdir here as i want to knw the
path *before* i have installed my app. Also, its like, i have to read some
files from the folder *where my setup is present*, and not from where it wud
get installed. But i cant use app.path as it gives me the path of msiexec in
system32 folder.

please advise some way.

thanks,
--
Vivek Thakur (MCP)
www.vivekthakur.com


"Phil Wilson" wrote:

> If you've installed the file in the application folder in the setup project,
> this is identified by the TARGETDIR property. So pass [TARGETDIR] into your
> custom action (via CustomActionData) and it will be the path to your
> directory.
> --
> Phil Wilson
> [Microsoft MVP-Windows Installer]
> Definitive Guide to Windows Installer
> http://apress.com/book/bookDisplay.ht...
>
> "Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
> news:6674A6D8-893C-4D44-89FA-A1E735513E3D@microsoft.com...
> > hi,
> >
> > i have a setup project and have a custom install class where i have this
> > method wich tries to find a file named X.txt which is in the same folder
> > as
> > the current msi (wich i double clicked).
> >
> > now i want to copy this X.txt to a location in C:\. For that i created the
> > custom install action class and wrote a method, but i cant access the
> > current
> > directory if i use application.path or other methods to get the current
> > directory. it always give me c:\windows\system32, which i think is logical
> > as
> > my setup calls msiexec.exe which is in the windows\system32 folder.
> >
> > is there any way to know where my msi exe is?
> > --
> > Vivek Thakur (MCP)
> > www.vivekthakur.com
>
>
>

Phil Wilson

4/3/2006 7:34:00 PM

0

I think you're saying that you want to copy some files that are in the same
directory as your MSI file. If so, pass [SourceDir] into your
CustomActionData - that's the location of your MSI file.
--
Phil Wilson [MVP Windows Installer]
----
"Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
news:5EFDE134-D93F-455C-A43A-9C5E44E8A07C@microsoft.com...
> Phil,
>
> thanks for yr response, but i cant use targetdir here as i want to knw the
> path *before* i have installed my app. Also, its like, i have to read some
> files from the folder *where my setup is present*, and not from where it
> wud
> get installed. But i cant use app.path as it gives me the path of msiexec
> in
> system32 folder.
>
> please advise some way.
>
> thanks,
> --
> Vivek Thakur (MCP)
> www.vivekthakur.com
>
>
> "Phil Wilson" wrote:
>
>> If you've installed the file in the application folder in the setup
>> project,
>> this is identified by the TARGETDIR property. So pass [TARGETDIR] into
>> your
>> custom action (via CustomActionData) and it will be the path to your
>> directory.
>> --
>> Phil Wilson
>> [Microsoft MVP-Windows Installer]
>> Definitive Guide to Windows Installer
>> http://apress.com/book/bookDisplay.ht...
>>
>> "Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
>> news:6674A6D8-893C-4D44-89FA-A1E735513E3D@microsoft.com...
>> > hi,
>> >
>> > i have a setup project and have a custom install class where i have
>> > this
>> > method wich tries to find a file named X.txt which is in the same
>> > folder
>> > as
>> > the current msi (wich i double clicked).
>> >
>> > now i want to copy this X.txt to a location in C:\. For that i created
>> > the
>> > custom install action class and wrote a method, but i cant access the
>> > current
>> > directory if i use application.path or other methods to get the current
>> > directory. it always give me c:\windows\system32, which i think is
>> > logical
>> > as
>> > my setup calls msiexec.exe which is in the windows\system32 folder.
>> >
>> > is there any way to know where my msi exe is?
>> > --
>> > Vivek Thakur (MCP)
>> > www.vivekthakur.com
>>
>>
>>


Vivek Thakur

4/3/2006 7:50:00 PM

0

Phil,

thanks a lot!! sometimes solutions can be so simple..but i am wondering why
isnt this documented anywhere.?? i did alot of rnd for this and didnt get
any useful thing..i got targetdir and assemblypath parameters but not
sourcedir..

anyways is shud ve used my brains..lol..

thanks a lot once again.,.,
--
Vivek Thakur (MCP)
www.vivekthakur.com


"Phil Wilson" wrote:

> I think you're saying that you want to copy some files that are in the same
> directory as your MSI file. If so, pass [SourceDir] into your
> CustomActionData - that's the location of your MSI file.
> --
> Phil Wilson [MVP Windows Installer]
> ----
> "Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
> news:5EFDE134-D93F-455C-A43A-9C5E44E8A07C@microsoft.com...
> > Phil,
> >
> > thanks for yr response, but i cant use targetdir here as i want to knw the
> > path *before* i have installed my app. Also, its like, i have to read some
> > files from the folder *where my setup is present*, and not from where it
> > wud
> > get installed. But i cant use app.path as it gives me the path of msiexec
> > in
> > system32 folder.
> >
> > please advise some way.
> >
> > thanks,
> > --
> > Vivek Thakur (MCP)
> > www.vivekthakur.com
> >
> >
> > "Phil Wilson" wrote:
> >
> >> If you've installed the file in the application folder in the setup
> >> project,
> >> this is identified by the TARGETDIR property. So pass [TARGETDIR] into
> >> your
> >> custom action (via CustomActionData) and it will be the path to your
> >> directory.
> >> --
> >> Phil Wilson
> >> [Microsoft MVP-Windows Installer]
> >> Definitive Guide to Windows Installer
> >> http://apress.com/book/bookDisplay.ht...
> >>
> >> "Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
> >> news:6674A6D8-893C-4D44-89FA-A1E735513E3D@microsoft.com...
> >> > hi,
> >> >
> >> > i have a setup project and have a custom install class where i have
> >> > this
> >> > method wich tries to find a file named X.txt which is in the same
> >> > folder
> >> > as
> >> > the current msi (wich i double clicked).
> >> >
> >> > now i want to copy this X.txt to a location in C:\. For that i created
> >> > the
> >> > custom install action class and wrote a method, but i cant access the
> >> > current
> >> > directory if i use application.path or other methods to get the current
> >> > directory. it always give me c:\windows\system32, which i think is
> >> > logical
> >> > as
> >> > my setup calls msiexec.exe which is in the windows\system32 folder.
> >> >
> >> > is there any way to know where my msi exe is?
> >> > --
> >> > Vivek Thakur (MCP)
> >> > www.vivekthakur.com
> >>
> >>
> >>
>
>
>

Phil Wilson

4/5/2006 2:07:00 AM

0

Visual Studio setup projects are Windows Installer setups, and the
properties you can use are listed here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/property_reference.asp?...
--
Phil Wilson
[Microsoft MVP-Windows Installer]

"Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
news:75BB15E7-B6A0-40B9-A0C6-CF7A3985764B@microsoft.com...
> Phil,
>
> thanks a lot!! sometimes solutions can be so simple..but i am wondering
> why
> isnt this documented anywhere.?? i did alot of rnd for this and didnt get
> any useful thing..i got targetdir and assemblypath parameters but not
> sourcedir..
>
> anyways is shud ve used my brains..lol..
>
> thanks a lot once again.,.,
> --
> Vivek Thakur (MCP)
> www.vivekthakur.com
>
>
> "Phil Wilson" wrote:
>
>> I think you're saying that you want to copy some files that are in the
>> same
>> directory as your MSI file. If so, pass [SourceDir] into your
>> CustomActionData - that's the location of your MSI file.
>> --
>> Phil Wilson [MVP Windows Installer]
>> ----
>> "Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
>> news:5EFDE134-D93F-455C-A43A-9C5E44E8A07C@microsoft.com...
>> > Phil,
>> >
>> > thanks for yr response, but i cant use targetdir here as i want to knw
>> > the
>> > path *before* i have installed my app. Also, its like, i have to read
>> > some
>> > files from the folder *where my setup is present*, and not from where
>> > it
>> > wud
>> > get installed. But i cant use app.path as it gives me the path of
>> > msiexec
>> > in
>> > system32 folder.
>> >
>> > please advise some way.
>> >
>> > thanks,
>> > --
>> > Vivek Thakur (MCP)
>> > www.vivekthakur.com
>> >
>> >
>> > "Phil Wilson" wrote:
>> >
>> >> If you've installed the file in the application folder in the setup
>> >> project,
>> >> this is identified by the TARGETDIR property. So pass [TARGETDIR] into
>> >> your
>> >> custom action (via CustomActionData) and it will be the path to your
>> >> directory.
>> >> --
>> >> Phil Wilson
>> >> [Microsoft MVP-Windows Installer]
>> >> Definitive Guide to Windows Installer
>> >> http://apress.com/book/bookDisplay.ht...
>> >>
>> >> "Vivek Thakur" <vivekatvivekthakur(donotspam)com> wrote in message
>> >> news:6674A6D8-893C-4D44-89FA-A1E735513E3D@microsoft.com...
>> >> > hi,
>> >> >
>> >> > i have a setup project and have a custom install class where i have
>> >> > this
>> >> > method wich tries to find a file named X.txt which is in the same
>> >> > folder
>> >> > as
>> >> > the current msi (wich i double clicked).
>> >> >
>> >> > now i want to copy this X.txt to a location in C:\. For that i
>> >> > created
>> >> > the
>> >> > custom install action class and wrote a method, but i cant access
>> >> > the
>> >> > current
>> >> > directory if i use application.path or other methods to get the
>> >> > current
>> >> > directory. it always give me c:\windows\system32, which i think is
>> >> > logical
>> >> > as
>> >> > my setup calls msiexec.exe which is in the windows\system32 folder.
>> >> >
>> >> > is there any way to know where my msi exe is?
>> >> > --
>> >> > Vivek Thakur (MCP)
>> >> > www.vivekthakur.com
>> >>
>> >>
>> >>
>>
>>
>>


Russell Stevens

4/6/2006 6:53:00 PM

0

Phil,

In another post you write

*********
The difficulty is when you try to add [TARGETDIR] as well it no longer
works. A CustomActionData that says /src=[SourceDir] /dst=[TARGETDIR] fails
with the FileNotFoundException. The issue seems to be that internally, the
project is generating a Windows Installer custom action that calls the
embedded InstallUtil DLL, passing:
/installtype=notransaction /action=install /LogFile= /src=[SourceDir]
/dst=[TARGETDIR] "[#_01E5F33094CF446280D30C8F055503CE]" "[VSDFxConfigFile]"

What happens is the the /src and /dst specs are in the middle of a logfile
specification, which breaks.
***************

Of course, if you want to copy files from the source to the target, you
need to know both at the same time. One workaround that seems to work;

1. Do the normal [TARGETDIR] custom action in the override for the install
class. While you are in there you can do your normal stuff.

2. In the Registry section, write the value of the [TARGETDIR] to the
registry (create a new key for your app).

3. Add another custom action for the commit phase to get the [SourceDir]

4. In the override for the commit class retrieve the [TARGETDIR] from the
registry, get the [SorceDir] from argument parameters. You now have
everything you need to copy stuff from the msi source folder to the target
folder. This is done in the commit phase instead of the install phase but
who cares after wasting all this time trying to figure out how to do it at
all <g>.

This works but why does Microsoft make something that should be trivial so
complicated <g>. Note the [SourceDir] only has a single "\" in the front if
the source is a UNC path - just another gotcha.....


Phil Wilson

4/9/2006 6:22:00 PM

0

It's my impression that a lot of people have started using Visual Studio for
setups and (because of the .NET association) are writing custom actions in
managed code. People who have been building MSI setups for years have been
writing C++ custom actions because Windows Installer supports them natively.
Managed custom actions are supported by a shim Dll that processes
CustomActionData and parses it into context in installer classes. If I ask
people why they want to have all that extra complication in their setups
it's usually because they don't want to learn C++ or go back to it, but the
issues you're having are a result, and this kind of thing:
http://support.microsoft.com/default.aspx?scid=kb;en...
http://support.microsoft.com/default.aspx?scid=kb;en...

See also http://www.installsite.org/pages/en/msifaq/...

--
Phil Wilson
[Microsoft MVP-Windows Installer]

"Russell Stevens" <rustyprogrammer@online.nospam> wrote in message
news:eTKETtaWGHA.3972@TK2MSFTNGP02.phx.gbl...
> Phil,
>
> In another post you write
>
> *********
> The difficulty is when you try to add [TARGETDIR] as well it no longer
> works. A CustomActionData that says /src=[SourceDir] /dst=[TARGETDIR]
> fails with the FileNotFoundException. The issue seems to be that
> internally, the project is generating a Windows Installer custom action
> that calls the embedded InstallUtil DLL, passing:
> /installtype=notransaction /action=install /LogFile= /src=[SourceDir]
> /dst=[TARGETDIR] "[#_01E5F33094CF446280D30C8F055503CE]"
> "[VSDFxConfigFile]"
>
> What happens is the the /src and /dst specs are in the middle of a logfile
> specification, which breaks.
> ***************
>
> Of course, if you want to copy files from the source to the target, you
> need to know both at the same time. One workaround that seems to work;
>
> 1. Do the normal [TARGETDIR] custom action in the override for the install
> class. While you are in there you can do your normal stuff.
>
> 2. In the Registry section, write the value of the [TARGETDIR] to the
> registry (create a new key for your app).
>
> 3. Add another custom action for the commit phase to get the [SourceDir]
>
> 4. In the override for the commit class retrieve the [TARGETDIR] from the
> registry, get the [SorceDir] from argument parameters. You now have
> everything you need to copy stuff from the msi source folder to the target
> folder. This is done in the commit phase instead of the install phase but
> who cares after wasting all this time trying to figure out how to do it at
> all <g>.
>
> This works but why does Microsoft make something that should be trivial so
> complicated <g>. Note the [SourceDir] only has a single "\" in the front
> if the source is a UNC path - just another gotcha.....
>