I have a wix project to which I added a custom window that checks the dependencies needed to run the app. This window comes up right after the License Agreement. Everything works fine, the dependencies are checked through custom actions and in case they are not fulfilled hyperlinks to official websites appear if the windows installer is above version5.
In case of a lower version I would like to click on a btn "Show dependencies" and to show the txt file with the links. I have the custom action below that open notepad and the property that contains the file.
Code:
<Property Id="FXDEP" Value="$(sys.CURRENTDIR)\Resources\Files\FxDependencies.txt" />
<Property Id='NOTEPAD'>NOTEPAD.EXE</Property>
<CustomAction Id='LaunchDependencies' Property='NOTEPAD' ExeCommand='[FXDEP]' Return='asyncNoWait' />
The problem is that on the dev machine it works since it finds the path, but on other of course it fails.
How should I tell wix to maintain this file and open it?
I tried putting the file into
<Binary Id="FxDependencies.txt" SourceFile="$(sys.CURRENTDIR)\Resources\Files\FxDependencies.txt" />
but the custom action does not recognize it.
You seem to be trying to open the file that resides in the source of your installation. You use the same values for FxDependencies.txt and FXDEP.
Your text file with dependencies resides in Binary table of the installer, to use it you have to extract it into a temporary directory, and then launch Notepad to display it.
To do it, you would have to write several custom actions:
The first CA extract the file into a temporary directory, and saves the path into a property, FXDEPTEMPPATH.
The second CA uses FXDEPTEMPPATH to display it in Notepad.
Another option is to write a small application (.exe) that would contain your FxDependencies.txt, in resources for example. You add this .exe into Binary table of MSI, and launch it instead of Notepad from the installer. In this case MSI will automatically extract the exe into a temporary directory and start it. In your application you create a new text file in temporary directory, by extracting the information from resources, and then launch Notepad to display it.
Edit: There's a number of ways to read a file from the Binary table. See these links for examples:
BinaryWrite from Msiext.
Reading from the Binary Table based on WiX source code.
Streaming a File from the Binary Table.
Write the code yourself:
Open a database view of the active database with MsiGetActiveDatabase and MsiDatabaseOpenView;
Read the binary stream with MsiRecordReadStream.
I would suggest you to create folder in custom action.
So,
Validate pre-requisites
Check windows installer version
If version is less than 5, call a custom action to create folder ($(sys.CURRENTDIR)\Resources\Files\)
Then on button click you can call the custom action to launch txt file
Related
I would like to know how I can load my own custom autocad files to the autocad working supported files without options inside Autocad software, but programmatically.
I have these following files that I want to load to supported files of autocad programatically ,
.cuix file
.vlx file
.mnl file
.mnr file
.fas file.
I tried with inno setup.
Honestly, I don't know how to do.
Please guide me or teach me how to do.
As per my understanding, you can achieve this stuff by Autoloading those File, while the AutoCAD is started, there is plenty amount of solution available on internet you may check this link1 Link2
Or you can refer below step(Before following this step read above link)
1.Write a function to load the required file as you mention in Question
(defun Load_File()
;To load CUIX file "<..MyPath.../MYMENU.CUIX>" replace this with you CUIX file path
(command "_MENULOAD" "<..MyPath.../MYMENU.CUIX>" "")
;To load VLX file "<..MyPath.../MY.VLX>" replace this with you VLX file e path
(command "_appload" "<..MyPath.../MY.VLX>")
;Loading a MNU file overwites the corresponding .MNR, .MNS and .MNC files. Keep in mind that if you make any custom toolbars ;and/or buttons using the graphical on-screen method - they will be wiped when you load the MNU
;(I am not sure about MNL/MNR file loading you may try this )
;To load MNLfile "<..MyPath.../MY.MNL>" replace this with you MNL file e path
(command "_appload" "<..MyPath.../MY.MNL>")
;To load Fas file
(load "<your .Fas file path/my.fas>"
)
(load_File)
2.save this file with name as Load_file.Lsp on trusted path (ie "c:/trusted path/...../Load_File.lsp")
(if lisp file is save in trusted path of AutoCAD so AutoCAD not show pop-up while lisp file is load )
3.make new lisp file so it can Autoload as AutoCAD is started with name "acad.lsp" put below code inside file (this code say that load our first "Load_File.lsp" file)
(load "c:/trusted path/...../Load_File.lsp")
this lisp file must be save in install directory of autocad (Ex. "C:\Program Files\Autodesk\AutoCAD 2018") this step is for automatically load "acad.lsp"
As soon as acad.lsp is loaded all your files are load in Autocad.
InnoSetup is a very good choice for You. I use it for few years and it let me do anything I need.
If You have InnoSetup installed, just click File->New and InnoSetup Script Wizard will guide you through the process of creation script. One of the steps is Application Files, where just select Your files mnu, cuix, fas whatever You like
After that compile ( just one click ) and You have Your setup.exe
Using Innosetup You may install files, but also manipulate OS registry - which may be helpful for Your application, but also set Acad supported files paths.
here
You can find more details about how to load Your application to Acad after is installed.
I'm creating a WIX installer for a C# application.
In the application I use System.Configuration.ConfigurationManager.AppSettings[Setting1] to get settings.
My question is, where must I place the program.exe.config file on the machine in order for it to work?
I can't place it with the program in ProgramFiles directory, since those files are read-only.
I tried:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
config.AppSettings.Settings[Config1].Value = "Value1";
config.Save();
Unfortunately I don't know where it's looking.
Thanks your replies, Trevy
It should be in the same folder of the program.exe. Use wix to copy both program.exe and program.exe.config to the required folder.
If you need to edit the configuration file during the installation you will need to do it using a custom action in wix. Make sure you pass the file path to the custom action and write the code to read the configurations in that file and edit.
The problem isn't that the files there are readonly - the problem is that you are trying to update files in the Program Files folder with your config.Save, and you can't do that if you are a limited user, and you are always limited (even if you are admin) unless you elevate. The short answer is that:
If your app routinely updates files in restricted areas then it probably needs elevation, so give it an elevation manifest.
If however you require you app to be used by limited users and allow them to update that config file then don't install to Program Files. Choose User Appdata folder, for example. Windows is probably using your config file during program startup, so you can't separate it from the exe.
When I was creating an installer for my app, I found I couldn’t save my settings.
The reason is because the Program Files repository, from a practical point of view, is read-only (Applications should never run with elevated permissions). When installing a program, the only time we modify the MyApp.exe.config file is at installation/upgrade/repair time.
The config file has many sections. One of them is userSettings. This is where we store any data we need to modify during the lifetime of the application. When run for the first time, Windows creates a hidden file in the user’s AppData folder. That is why we can save user settings, even though the config file is in the same directory as the MyApp.exe
So the answer is, if we run into permission errors when trying to save our settings it means we are writing our settings to the wrong section of the config file. We need to place it in the userSettings section and nowhere else.
For convenience, Visual Studios has a settings editor (the settings tab of the properties page). It allows you to create strongly typed user and application settings. The generated class lets you save user settings, but not application settings for the above reasons.
When uninstalling my app, I'd like to configure the WiX setup to remove directories and like user settings and user data I want add a dialog with two check boxes and optionally remove all the files that were added. It looks like the uninstaller removes only the directories and files that were originally installed from the MSI file .
In other words, I want to give user a chance to Delete his data with a dialog while uninstall is called ?
Is this possible through WiX without resorting to custom actions? Any help would be appreciated.
To do this without using custom actions, see the WiX documentation regarding the RemoveFile and RemoveFolder elements. You can use these to remove files and folders on uninstallation. RemoveFolder will only work if the folder is empty.
Note that if the files are located in the user's application data directory, you will only be able to do this for the user that is uninstalling the application. You cannot easily do it for all users.
I have to read an ini file with Wix. This ini file is created by the installer itself by a custom action (an exe file generates the ini file).
Problem:AppSearch (where the ini file is read) is the first step of the InstallUISequence.
Even if I call the CA before AppSearch, I get an error because when I try to read the ini file, it is not created yet..(Return="asyncWait" in the CA).
Here is the call:
<InstallUISequence>
<Custom Action="LaunchCA" Before="AppSearch" />
</InstallUISequence>
Is there a solution? Thanks!
Windows Installer INI searches support only files in C:\Windows folder. So using a search is not feasible.
Instead, you can try using a custom action (custom code written by you) to read the file. I assume you want to save the result in some installer properties. So your custom action will need to receive the installation handle.
So, what you need is to access the data in that generated INI file, right? Do you control the way that EXE outputs the data?
If you do, you can make that data to be dumped not to INI file, but to the custom MSI table instead. Later on, your CA to read the contents of the INI file doesn't have to wait for it to gets created and you'll get rid of the AppSearch dependency.
I am developing an MSI installer by using WiX.
The main program installs to [APPLICATIONFOLDER]. I use the InstallDirDlg to set the directory of this without any issues.
I'd like to display a custom dialogue based on the InstallDirDlg to specify a directory to install a particular component. I'd like to set the default directory to [APPLICATIONFOLDER]\Resources. However when I run the installer, I get an error, code 2343.
I think this may be a problem with displaying a second level folder in the dialogue.
You could take a look at how this is done in the WixUI FeatureTree UI example. In particular, look at the CustomizeDlg.
The error 2343 means "Specified path is empty.", so you have probably set a property incorrectly. Looking at the log files generated by your installer may also help.