I am trying to include a link to my application in the Startup folder with a parameter passed to the program.
I think it would work if I created the shortcut locally and then added it to my source. After that I could copy it to the Startup folder on first run.
File.userDirectory.resolvePath("Start Menu\\Programs\\Startup\\startup.lnk");
However, I am trying to get this to occur during install. I see there is are some settings related to the installation in app.xml, but nothing that lets me install it to two folders, or use a parameter.
<!-- The subpath of the standard default installation location to use. Optional. -->
<!-- <installFolder></installFolder> -->
<!-- The subpath of the Windows Start/Programs menu to use. Optional. -->
<!-- <programMenuFolder></programMenuFolder> -->
I'm new to Air, but also haven't found any way to customize the install process. It looks like you're limited to your application code. (Updating appears more flexible.)
From your example, it looks like you want your app' to run with a parameter constant each time Windows starts. So you're probably already aware you can set:
NativeApplication.nativeApplication.startAtLogin=true
when your app' first runs. Could you combine this with your parameter in a settings file in the application or user directory and accomplish what you need?
Related
Short story: Is there a way to specify the location of the log files, other than passing it as an argument at the beginning? If no, how can I pass arguments to a bundle running embedded (on updates)?
Long story: To avoid the requirement of the user to provide admin rights on every update, we give them the option to install our ElevationService. This Service runs as SYSTEM and is used to automatically start our new bundle with SYSTEM rights to install it. In this case, we pass the argument -log <path> to the new bundle to ensure, the logs are written to the right path. By default C:\Windows\Temp would be used and we don't want that. So far, so good! But at the end of the bundle update the old bundle gets uninstalled. This is done embedded, and so the log files of the embedded setup instance are gonna be written to the default path (C:\Windows\Temp). Is there a way how we can change that?
If you are using a Bundle, look at:
<Log Prefix="path-to-log-file-here" />
I've created a console app (VS2015, target framework 4.5.2) and I have used My Project/Settings to create application level settings. All the documentation and answers here on stackoverflow.com tell me (and this is the way I've always understood it to work) that the app.config file are where these things are stored and I can indeed see these settings in app.config and I can open settings.vb to look at the properties and their default values.
So far so good, when I compiled this and chucked ONLY the executable on a different machine, as expected it worked. I am assuming this is because settings.vb is compiled into the app.
But I am left with an application for which I can't change the settings. Where do I now put the app.config so that I can indeed change the settings in the XML and have my application use those settings instead of the default ones next time? I hope I don't have to build an installer or do a publish because to me that completely defeats the purpose of console applications.
By default the settings in app.config are also embedded into your code (just for those situations like what you describe... where you just have the EXE without any *.config file). You can change this behavior by changing the GenerateDefaultValueInCode for each setting.
There are two sections to the file... the application section has the read-only setting for the entire app. The user section has the starting default values of the settings that the user can change.
So, just to review:
app.config = the design-time version of all the settings (it gets
renamed and copied to bin)
YourApplication.exe.config = the run-time
version of the all of the settings
%LOCALAPPDATA%\App\Version\user.config = just the user portion of the
settings after they've made changes
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.
I have a wix installer which installs several web sites. Each website is a feature. There is a custom dialog which allows to enter database connection strings. Each feature contains a component which changes configuration file using the data entered in a dialog. It works fine.
Then I run the same installer and select the option Change. I do not change features set but I change connection strings. Then my changes are not applied to configuration files.
I understand why it happens, no feature change = no component run.
But is there a way to always change config files during change operation even if features list doesn't change?
I am writing an application in VB.NET. In the app, I have a function which calls a Powershell script and places the resulting information in a text box.
I have two issues:
How to I ensure that when my app is published, the powershell script is included?
How do I reference the script in my code?
Currently, I simply give my function the full path to the script, which is in a folder on my Desktop. Obviously, this will not work once I deploy the app to other computers.
You will need to create a Setup project to get your script in place on your target system.
A first step is to change the Build Action to Content and Copy to Output Directory to Copy always.
Your Setup project can pick up the script from the VB app build result and put it in place when installing your app.
As for your question concerning the user configurable install path: The easiest way to handle this would be to add registry entry containing the selected program file path and have your app read the path from there.