This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Copy file from CD to install directory
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 22, 2015
07:22 AM
Copy file from CD to install directory
Hi,
I have been looking into this issue for about 4 hours and have got pretty much nowhere, it cannot be that hard surely?
All i am trying to do is copy a file from the same destination as the installer into the install directory. This needs to be done as the user manual is never ready to go when the installer is built so i am looking for a way to have the user manual on the CD and then it gets copied into the install directory after the install.
I have been attempting to do this with the MoveFile table and have set up an entry as below
FileKey : CopyUserManual
Component : UserManual
SourceName : User Manual.pdf
DestName: User Manual.pdf
SourceFolder : SOURCEDIR
DestFolder : INSTALLDIR
Options : 1
At first the installer didn't work at all as i hadn't included the component in the project. I did that and then the installer ran but the file was not copied
Does anyone have any ideas as to where i am going wrong??
Thanks in advance
Ross
I have been looking into this issue for about 4 hours and have got pretty much nowhere, it cannot be that hard surely?
All i am trying to do is copy a file from the same destination as the installer into the install directory. This needs to be done as the user manual is never ready to go when the installer is built so i am looking for a way to have the user manual on the CD and then it gets copied into the install directory after the install.
I have been attempting to do this with the MoveFile table and have set up an entry as below
FileKey : CopyUserManual
Component : UserManual
SourceName : User Manual.pdf
DestName: User Manual.pdf
SourceFolder : SOURCEDIR
DestFolder : INSTALLDIR
Options : 1
At first the installer didn't work at all as i hadn't included the component in the project. I did that and then the installer ran but the file was not copied
Does anyone have any ideas as to where i am going wrong??
Thanks in advance
Ross
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 22, 2015
01:24 PM
So, what you want to do is add a file to the CD after your installation package is built, and copy it to a target folder during installation?
It is not impossible, but you will inevitably face quite a few limitations:
[LIST=1]
You cannot include a file to an MSI package before this file actually exists. Consequently, you cannot add a file to an MSI package after this package was built. You could possibly use a Transform file, but that's a different story.
I don't think you can change an existing file in the source folder after building the MSI package either. I think the MSI package contains quite a few checksum to make sure that the source files are intact.
You might also face an issue with the package size. The capacity of a CD is limited, and InstallShield will spread your files (or your cabinet file) on several CD's if the overall size of the package exceeds the size of a CD. So adding files to a CD after the package has been built is not a good idea, even if these files are just "advanced support files".
The best way to handle this would be to build your package once all the files (including your user manual) have been produced, and adapt your development process accordingly. In other words: get your technical writers to finish their job earlier.
If you really want to supply a user manual that can change until the last minute, you should consider uploading it to a website that your customers can access.
However, if you are not able to adapt your development process to these good practice, here is an idea:
This idea will not overcome problem no3 listed above, though.
Another possibility would consist of building a patch that simply adds your user manual to your product.
You would obviously build this patch AFTER building the main installation package.
Push this reasoning further, and create a separate installation package for your user manual, then chain both installations.
Any other idea? A transform file, maybe? But honestly, your life would be easier if you had all files before building your package.
It is not impossible, but you will inevitably face quite a few limitations:
[LIST=1]
The best way to handle this would be to build your package once all the files (including your user manual) have been produced, and adapt your development process accordingly. In other words: get your technical writers to finish their job earlier.
If you really want to supply a user manual that can change until the last minute, you should consider uploading it to a website that your customers can access.
However, if you are not able to adapt your development process to these good practice, here is an idea:
- Do not create any component in your installation package for this file.
- Now let's assume you have just copied this file to a subfolder of your CD.
- Create a custom action that just copies this file from one subfolder of the CD to the target directory.
- You need to create a similar action that removes this file from the target folder on uninstall.
- Also, don't forget the rollback actions!
This idea will not overcome problem no3 listed above, though.
Another possibility would consist of building a patch that simply adds your user manual to your product.
You would obviously build this patch AFTER building the main installation package.
Push this reasoning further, and create a separate installation package for your user manual, then chain both installations.
Any other idea? A transform file, maybe? But honestly, your life would be easier if you had all files before building your package.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 26, 2015
08:33 AM
Thanks for the reply, basically yes that is what i am attempting to do
I was afraid that was the answer, unfortunately this is a requirement from higher up and was dumped on my desk!!! I requested a reason at the time as to why the user manual could not be produced in time to go with the release and there has been no answer!!, not really a surprise though
Looking at my options i think the best is the custom action route, our installer is only about 200MB so there is no issue on size at all
Thanks for the additional actions regarding uninstall as i probably would have forgotten about them
Regards
Ross
I was afraid that was the answer, unfortunately this is a requirement from higher up and was dumped on my desk!!! I requested a reason at the time as to why the user manual could not be produced in time to go with the release and there has been no answer!!, not really a surprise though
Looking at my options i think the best is the custom action route, our installer is only about 200MB so there is no issue on size at all
Thanks for the additional actions regarding uninstall as i probably would have forgotten about them
Regards
Ross
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 26, 2015
01:47 PM
In theory, you could add some items to the Component and File tables at runtime, so you could benefit from the install/uninstall/rollback mechanism. It would also allow to use the existing version check mechanism (think about the minor upgrade scenario: the files with the highest version wins).
Not sure how that would work with file checksums, but it could be worth a try.
Not sure how that would work with file checksums, but it could be worth a try.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 17, 2015
06:27 AM
I have finally got around to trying this (ran out of actual work to do!!!) and have made progress
function CopyUserManual(hMSI, destDirectory)
NUMBER nResult;
STRING error;
STRING sourcePath;
begin
sourcePath = SourceDir;
nResult = CopyFile(sourcePath ^ USER_MANUAL_NAME, destDirectory ^ USER_MANUAL_NAME);
error = FormatMessage(nResult);
end;
There is a path set during the installation that holds the data files and the User Manual needs to go in there as well. If i put in a proper path instead of destDirectory it works fine, however i need to pass that value in from the installer. Is there a way to do this?
Thanks
function CopyUserManual(hMSI, destDirectory)
NUMBER nResult;
STRING error;
STRING sourcePath;
begin
sourcePath = SourceDir;
nResult = CopyFile(sourcePath ^ USER_MANUAL_NAME, destDirectory ^ USER_MANUAL_NAME);
error = FormatMessage(nResult);
end;
There is a path set during the installation that holds the data files and the User Manual needs to go in there as well. If i put in a proper path instead of destDirectory it works fine, however i need to pass that value in from the installer. Is there a way to do this?
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 20, 2015
10:39 AM
Just in case someone else is trying to do something similar, i have managed to get it to work
function CopyUserManual(hMSI)
STRING dataPath, error, sourcePath;
NUMBER nvType, nvSize, nResult, nBufferSize;
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBGetKeyValueEx("SOFTWARE\\EuroAvionics\\EasyTask", "ETGSDataPath", nvType, dataPath, nvSize);
if (StrLengthChars(dataPath) > 0) then
//Do Nothing
else
RegDBGetKeyValueEx("SOFTWARE\\Wow6432Node\\EuroAvionics\\EasyTask", "ETGSDataPath", nvType, dataPath, nvSize);
endif;
nBufferSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SETUPEXEDIR", sourcePath, nBufferSize);
nResult = CopyFile(sourcePath ^ USER_MANUAL_NAME, dataPath ^ USER_MANUAL_NAME);
error = FormatMessage(nResult);
end;
Luckily we were already storing the datapath selected during the install in the registry as we need it when the program runs so i can use that as the destination. Getting the source path proved more challenging as the installer thinks it is running from a temp directory as that is where it is extracted to. In the end i found the SETUPEXEDIR which points to the actual exe location.
function CopyUserManual(hMSI)
STRING dataPath, error, sourcePath;
NUMBER nvType, nvSize, nResult, nBufferSize;
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBGetKeyValueEx("SOFTWARE\\EuroAvionics\\EasyTask", "ETGSDataPath", nvType, dataPath, nvSize);
if (StrLengthChars(dataPath) > 0) then
//Do Nothing
else
RegDBGetKeyValueEx("SOFTWARE\\Wow6432Node\\EuroAvionics\\EasyTask", "ETGSDataPath", nvType, dataPath, nvSize);
endif;
nBufferSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SETUPEXEDIR", sourcePath, nBufferSize);
nResult = CopyFile(sourcePath ^ USER_MANUAL_NAME, dataPath ^ USER_MANUAL_NAME);
error = FormatMessage(nResult);
end;
Luckily we were already storing the datapath selected during the install in the registry as we need it when the program runs so i can use that as the destination. Getting the source path proved more challenging as the installer thinks it is running from a temp directory as that is where it is extracted to. In the end i found the SETUPEXEDIR which points to the actual exe location.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 21, 2015
07:42 AM
And did you implement rollback and uninstall custom actions?
What about minor upgrades?
What about minor upgrades?