I currently have two WIX projects - one for creating an x86 installer and one for creating an x64 installer. I would like to combine these two projects into just one project which uses variables to control program flow.
I have the following:
<?if $(var.Platform) = x64 ?>
<?define ProductName = "CableSolve Web (64 bit)" ?>
<?define Win64 = "yes" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define ProductName = "CableSolve Web" ?>
<?define Win64 = "no" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>
and I went into Visual Studio -> Build -> Configuration Manager and set things like so:
I then went through and removed all of the "Win64='yes'" and "Win64='no'" parameters in all the components /directories of both projects.
I am wondering if there is something more to it than this, though. When I create my x64 installer I see it trying to install to C:\Program Files (x86)... and not to C:\Program Files. I am assuming that this means the code is dropping down to the 'else' statement -- but I do not know of a way to confirm this.
Are there other variables which need to be set in order to ensure proper generation of an x64 install path?
Thanks
I inherited all of the installer code below (excluding the variables I am currently working on adding). I've added the $(var.PlatformProgramFilesFolder) as well as the EnvironmentVariables wxi.
EDIT2: This is probably the culprit, but trying to find why its configuration is x86:
------ Skipped Rebuild All: Project: CS Web Installer x64, Configuration: Release x86 ------
Two things:
You need to set Platform="x64" attribute in Package element to get 64bit .msi file
Where is $(var.Platform) variable initialized? If you intended to use WIX built-in platform variable then you should rather use $(sys.BUILDARCH) or $(sys.PLATFORM) depending on WIX version.
Related
Can I create a 'Python Distribution' with my module directly using PTVS(Python Tools for Visual Studio) ? I have done this before using command line but not using PTVS. If yes, how ?
Thanks!
Currently no. I think the feature you'd like to vote on is Feature: build package. If you've done this with py2exe or other packages in the past then you could wire this directly into PTVS with our 2.1 release. This will give you a context menu on your project which will let you run the command from within the IDE.
To do this you'd modify your .pyproj file and add something like:
<PropertyGroup>
<PythonCommands>$(PythonCommands);PythonRunPyLintCommand</PythonCommands>
<PyLintWarningRegex>
<![CDATA[^(?<filename>.+?)\((?<line>\d+),(?<column>\d+)\): warning (?<msg_id>.+?): (?<message>.+?)$]]>
</PyLintWarningRegex>
</PropertyGroup>
<Target Name="PythonRunPyLintCommand"
Label="Run PyLint"
DependsOnTargets="ResolveStartupPath"
Returns="#(Commands)">
<CreatePythonCommandItem Target="pylint.lint"
TargetType="module"
Arguments=""--msg-template={abspath}({line},{column}): warning {msg_id}: {msg}" -r n #(Compile, ' ')"
WorkingDirectory="$(WorkingDirectory)"
ExecuteIn="output"
RequiredPackages="pylint>=1.0.0"
WarningRegex="$(PyLintWarningRegex)">
<Output TaskParameter="Command" ItemName="Commands" />
</CreatePythonCommandItem>
</Target>
This example is shelling out to PyLint but you can change TargetType to executable/script/code or pip to execute different things. And you can change ExecuteIn to console, output, or repl to have the output show up in various different locations.
After installing extension in VS 2012 it is placed in %userprofile%AppData\Local\Microsoft\VisualStudio\11.0\Extensions\ (or in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions if it is installed for all users) and in folder with random name like "hilatg23.234" or "kcsuvnvi.qtq". Is there a way to specify the name of this folder and make this extension to install to folder like %userprofile%AppData\Local\Microsoft\VisualStudio\11.0\Extensions\MY_EXTENSION_NAME
Hm, don´t think so. The VSIX installer will always choose the installation directory automatically. If you want to let the user decide about the installation folder, you´d need to create a MSI installation package.
A while ago I answered another question regards the package registration; maybe some of the provided information might help to create such a setup. See post at: MSI installed VSPackage is loaded in Experimental Instance only
If you just want to obtain the package installation folder at runtime, you can just get it from the package´s assembly codebase, like:
private static string ObtainInstallationFolder()
{
Type packageType = typeof(MyPackage);
Uri uri = new Uri(packageType.Assembly.CodeBase);
var assemblyFileInfo = new FileInfo(uri.LocalPath);
return assemblyFileInfo.Directory.FullName;
}
My solution:
I use this api get vsix install physical path:
string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
path = \AppData\Local\Microsoft\VisualStudio\...\Extensions\[install path]\xx.dll
You can control the name of the Extensions<folder> with this msbuild property in your vsix project file:
<ExtensionInstallationFolder>YourExtensionName</ExtensionInstallationFolder>
Which Visual Studio (2010 (Professional (64-bit (on Windows 7 (Professional (64-bit)))))) points to the .exe name?
Some examples of variables are:
Variable Sample value
=================== =============================
$(TargetPath) C:\...\obj\Debug\Project1.exe
$(ItemPath) C:\...\Project1.csproj
$(SolutionFileName) Solution1.sln`
$(ProjectFileName) Project1.csproj
i need the executable, e.g.:
$(ExePath) C:\...\Bin\Debug\Project1.exe
Except $(ExePath) is something i just made up.
Note:
$(TargetPath) references the obj path. i need the target bin path
$(TargetPath) is the application to run eg. in the debugger
You can list all variable by go to project Properties/Build Events/ Edit Pre- or Post-build... and click on Macros >> button.
Specially for builded .exe you need $(TargetPath)
According to MSDN, it's $(TargetPath).
There is no official variable for the path to .exe in bin directory, but you can use
$(BinDir)$(TargetName)$(TargetExt)
to achieve the same effect.
I need to use variable in WIX localization file WIXUI_en-us.wxl.
I tried use it like this:
<String Id="Message_SomeVersionAlreadyInstalled" Overridable="yes">A another version of product $(var.InstallationVersionForGUI) is already installed</String>
But it doesn't work. And when I declared property and used it this way:
<String Id="Message_SomeVersionAlreadyInstalled" Overridable="yes">A another version of product [InstallationVersionForGUI] is already installed</String>
doesn't work either.
Where was I wrong?
Thanks for help and your time.
Localization strings are processed at link time, so you can't use $(var) preprocessor variables. Using a [property] reference is supported, as long as the place where the localization string is used supports run-time formatting (e.g., using the Formatted field type).
Your second method should work just fine. This is the same method used by the default .wxl files.
For example, in your .wxl file you would declare your string:
<String Id="Message_Foo">Foo blah blah [Property1]</String>
And in your .wxs file, you declare the property. If you wish, you can declare the property to match a WiX variable (which it sounds like you're trying to do)
<Property Id="Property1">$(var.Property1)</Property>
I was trying to get localization file to use variables. Came across this post:
There are different layers of variables in WiX (candle's preprocessor
variables, Light's WixVariables/localization variables/binder
variables, and MSI's properties). Each have different syntax and are
evaluated at different times:
Candle's preprocessor variables "$(var.VariableName)" are evaluated
when candle runs, and can be set from candle's commandline and from
"" statements. Buildtime environment
properties as well as custom variables can also be accessed similarly
(changing the "var." prefix with other values).
Light's variables accessible from the command-line are the
WixVariables, and accessing them is via the "!(wix.VariableName)"
syntax. To access your variable from your commandline, you would need
to change your String to: This build was prepared on
!(wix.BuildMachine)
If you instead need to have the BuildMachine value exist as an MSI
property at installation time (which is the "[VariableName]" syntax)
you would need to add the following to one of your wxs files in a
fragment that is already linked in:
Now, the environment variable COMPUTERNAME always has held the name of
my build machines in the past, and you can access that this way:
$(env.COMPUTERNAME). So, you can get rid of the commandline addition
to light.exe and change your wxs file like this:
<WixProperty Id="BuildMachine" Value="$(env.COMPUTERNAME)"/>
Preprocessor variables $(var.VariableName) are are processed at link time, so ideally you would use [PropertyName] which would be defined on the main Product element.
The issue sometimes is that property is not yet defined, for instance using the product name on the localization file seems not posible.
This solution was done aiming to only type the product name once given "Super product" as product name:
In case of running through visual studio extension:
Project properties -> Build -> Define variables -> "MyProductName=Super product" (No quotes)
In case of runing from cmd or some other place:
On Light.exe, add -d"MyProductName=Super product"
Into the localization .wxl file:
<String Id="Description" Overridable="yes">Description of !(wix.MyProductName)
to make it more interesting</String>
I have an aditional config file .wxi I include on other files to have some vars, for instance, here i had hardcoded the value but now it's harcoded on the variable definition and I use the given value:
<?xml version="1.0" encoding="utf-8"?>
<Include>
<!-- Define the product name preprocesor variable -->
<?define ProductName="!(wix.ProductNameDefVar)" ?>
<!-- From this point, can use the preprocesor var -->
<?define ProductName_x64="$(var.ProductName) (64bit)" ?>
<?define ProductName_x32="$(var.ProductName) (32bit)" ?>
<?define CompanyDirName = "My company name" ?>
</Include>
Finally, the place where the localization value where the localization text was not interpolating, is like this:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!-- Include the config file with the preprocesor var -->
<?include $(sys.CURRENTDIR)\Config.wxi?>
<!-- Main product definition -->
<Product Id="$(var.ProductCode)"
Name="$(var.ProductName)"
Language="!(loc.Language)"
Version="$(var.BuildVersion)"
Manufacturer="!(loc.Company)"
UpgradeCode="$(var.UpgradeCode)">
<!-- Package details -->
<!-- Here, Description was not interpolating -->
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
Platform="$(var.Platform)"
Manufacturer="!(loc.Company)"
Description="!(loc.Description)"
Keywords="!(loc.Keywords)"
Comments="!(loc.Comments)"
Languages="!(loc.Language)"
/>
[...]
I am getting a warning when trying to include the .net 3.5 sp1 prerequisite for my setup project. The warning states Prerequisite could not found for bootstrapping.
Any suggestions?
Thanks
I followed the directions in 2.3.1.1 Enable Samesite for the .NET Framework 3.5 SP1 bootstrapper package and now everything works perfect.
Thanks
Ultimately, having had the same issue as the creator Ryan, I solved my delima by folling these steps:
Update the Package Data
Open the [Program Files]\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 folder or %ProgramFiles(x86)%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 on x64 operating systems
Edit the Product.xml file in Notepad.
Paste the following into the < PackageFiles > element:
<PackageFile Name="TOOLS\clwireg.exe"/>
<PackageFile Name="TOOLS\clwireg_x64.exe"/>
<PackageFile Name="TOOLS\clwireg_ia64.exe"/>
Find the element for < PackageFile Name="dotNetFX30\XPSEPSC-x86-en-US.exe" and change the PublicKey value to: 3082010A0282010100A2DB0A8DCFC2C1499BCDAA3A34AD23596BDB6CBE2122B794C8EAAEBFC6D526C232118BBCDA5D2CFB36561E152BAE8F0DDD14A36E284C7F163F41AC8D40B146880DD98194AD9706D05744765CEAF1FC0EE27F74A333CB74E5EFE361A17E03B745FFD53E12D5B0CA5E0DD07BF2B7130DFC606A2885758CB7ADBC85E817B490BEF516B6625DED11DF3AEE215B8BAF8073C345E3958977609BE7AD77C1378D33142F13DB62C9AE1AA94F9867ADD420393071E08D6746E2C61CF40D5074412FE805246A216B49B092C4B239C742A56D5C184AAB8FD78E833E780A47D8A4B28423C3E2F27B66B14A74BD26414B9C6114604E30C882F3D00B707CEE554D77D2085576810203010001
Find the element for < PackageFile Name="dotNetFX30\XPSEPSC-amd64-en-US.exe" and change the PublicKey value to the same as in step 4 above
Save the product.xml file
Download and Extract the Core Installation Files
Navigate to the following URL: http://go.microsoft.com/fwlink?LinkID=118080
Download the dotNetFx35.exe file to your local disk.
Open a Command Prompt window and change to the directory to which you downloaded dotNetFx35.exe.
At the command prompt, type:
dotNetFx35.exe /x:.
This will extract the Framework files to a folder named “WCU” in the current directory.
Copy the contents of the WCU\dotNetFramework folder and paste them in the %Program Files%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 folder (%ProgramFiles(x86)%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFx35SP1 on x64 operating systems). Note: Do not copy the WCU\dotNetFramework folder itself. There should be 5 folders under the WCU folder, and each of these should now appear in the DotNetFx35SP1 folder. The folder structure should resemble the following:
o DotNetFx35SP1 (folder)
dotNetFX20 (folder
dotNetFX30 (folder)
dotNetFX35 (folder)
dotNetMSP (folder)
TOOLS folder)
en (or some other localized folder)
dotNetFx35setup.exe (file)
You may now delete the files and folders you downloaded and extracted in steps 2 and 4.
Found at Microsoft Solutions
For VS 2015, here is a very simple solution (including some Michael Eakins answer):
Download the installer here:
http://go.microsoft.com/fwlink?LinkID=118080
Extract / open with 7zip or Winrar and extract the contence to a folder
Copy/move everything under the extracted folder "wcu\dotNetFramework" path to:
C:\Program Files (x86)\Microsoft Visual Studio 4.0\SDK\Bootstrapper\Packages\DotNetFX35SP1
Publish in VS2015