Passing file name in Custom Action using WiX - wix

I want to pass a file name in the argument of Custom Action. These files are getting installed into the system. Can I pass the component id of these files rather than passing hard coded name?

Since Wix has provided Session variables to communicate with C# custom actions ....assign your files path in some Session variable and use it in custom action...
Make sure that the variable name should be in CAPS

Related

How to set custom value to Wix Bundle Log Element?

If I put a hard-coded value it works fine
<Log PathVariable="C:\myProjectDir\myLogs\log.txt"/>
 
But if I make a separate variable and replace the hard-code, it does NOT work
<Log PathVariable="[LogLocation]"/>
<Variable Name="LogLocation" bal:Overridable="no" Type="string" Value="C:\myProjectDir\myLogs\log.txt" Persisted="yes"/>
 
I found something on the lines of <WixVariable Id="WixBundleLog"/> but I don't really know how to use it.
My end goal here is that I have a bootstrapper application and I want to change the location where logs of my msi and exe installation is created
I able able to change a Variable element value using _bootstrapper.Engine.StringVariables["LogLocation"] = "C:\ProjectGorilla\logs\log.txt"
Using the above code in C#, the Variable Id="LogLocation" is changed but that change is not reflected in Log element's PathVariable
So, my question is how can I put a variable in PathVariable attribute of Log element
Thanks in advance :)
According to the documentation, the PathVariable attribute is:
Name of a Variable that will hold the path to the log file. An empty value will cause the variable to not be set. The default is "WixBundleLog".
PathVariable does not specify the path where the (bundle) log will be written. It is a variable that the BA is supposed to read if it wants to copy the file somewhere else. The Burn engine never reads this variable's value so changing it during runtime won't do anything.
The (bundle) log is created (https://github.com/wixtoolset/wix3/blob/58abd6993afba08b39e37b0e76b1790161df9231/src/burn/engine/engine.cpp#L499) before loading the BootstrapperApplication (https://github.com/wixtoolset/wix3/blob/58abd6993afba08b39e37b0e76b1790161df9231/src/burn/engine/engine.cpp#L545). There is no way for the BA to change the path.
The package (MSI, EXE, etc) log locations work the same way today as the bundle log. However since they are created after loading the BA, it's theoretically possible that someone could implement a feature so that the BA can change their path.

set TRANSFORMS argument in custom action

Can I set the TRANSFORMS argument value in the custom action within the MSI ? If Yes, need to set the custom action being called at which stage ? Thanks.
Transforms can't be applied dynamically during an installation. They have to be applied at the time the installation is started. A custom bootstrapper (EXE) could use business logic to select a transform and apply it when starting the installation.
You can also embed the mst files into the _Storages table inside the MSI, and windows will auto-detect the supported transforms for you.
https://msdn.microsoft.com/en-us/library/aa368351(v=vs.85).aspx

Save the modified Property file inside WAR deployed on server

We are trying to use Apache PropertiesConfiguration in our project using JSF and JBoss.
My property file is located inside a package say demo.prop by the name of Prop1.prop
Inside my WAR file the same is present under /WEB-INF/classes/demo/prop/Prop1.prop
Using
FacesContext.getCurrentInstance().getExternalContext().getResource("/WEB-INF/classes/demo/prop/Prop1.prop");
I am able to fetch the property file. So when I try to extract a string from the property file using
PropertiesConfiguration pc1=new PropertiesConfiguration(a);
String s1=(String)pc1.getProperty("User_Name");
I am able to get the proper string. Using set property method I am able to set the property also.
pc1.setProperty("User_Name", "hardcodedString");
But I am not able to save the FILE back to this location. No matter what I do it is not able to save the file using pc1.save.
Can anyone please try to tell me how can I save this file back to its original location so that the changes done in the property file remain as it is.
Modifying the WAR file is a bad idea (for example, some web servers may notice the file
modification an redeploy your app, there may be problems when the server explodes the war on deployment etc.)
I would suggest applying an alternative approach - some possibilities are:
Place the properties in a database table, so they can be easily modified
Use an external properties file for overriding your "Prop1.prop" file settings. You can pull this off for example as follows. Assume that the default property values are bundled in your WAR and the modified values are saved to some other path, which is defined using a system property - let say it's called CONFIG_LOCATION. Now after loading your properties from the bundle you read them also from this external "overrides.prop" file - this overrides your defaults from "Prop1.prop":
PropertiesConfiguration pc1=new PropertiesConfiguration(a);
try(FileReader propReader = new FileReader(System.getenv().get("CONFIG_FILES") +"/overrides.prop"){
pc1.load(propReader);
}
When you need to save changes, you do that to "overrides.prop" - this will save all
the properties, not only the changed ones, but that should have no negative effects.

Is there a CommandParameter in XAML/WinRT?

Can a CommandParameter be passed to a Command in WinRT? How?
Actually, I may have misunderstood your question entirely. If you are talking about UI commands (commands that implement the ICommand interface) you can pass parameters when you call Execute. You can also test if the command and parameters are valid before executing the command by calling CanExecute.
As for passing a parameter as part of a Button binding, set the Command property equal to the command you want the button to execute and set the CommandParameter property equal to the parameter you want to pass.
Yes and no. WinRT applications can receive parameters through the Application.OnLaunched override.
The override receives an instance of type LaunchActivatedEventArgs which includes the arguments.
So it is possible to receive arguments, the question is more about how they can be passed.
Windows Store (WinRT) applications cannot be started from the command line. If a WinRT application is associated with a file type, it can be launched by calling ShellExecute on a file. Other than that, the application cannot be started directly.
It is possible to write C++ that launches a WinRT application using the IAplicationActivationManager interface and this interface can pass parameters to the launched application. So you could create a C++ launcher executable that could be called from the command line.
For more information on how to launch an application using this interface, see the following forum post:
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/a4d2fca1-4034-4cc7-a86a-6242ce1a8b16

how to modify luntbuild mail notification template?

We are using luntbuild-1.6.2 for build automation. We would like to add a couple of variables in the email notification sent via luntbuild like subversion location etc.
Is it possible to modify the email template for luntbuild?
After reading the manual once again I was able to locate the files where the template resides.
Simple edit
<luntbuild installation path>/templates/email/simple-build.vm
file and you can customize the template using a set of predefined variables.