I know there are many similar questions about this theme, but none of them could give me an answer.
I'm creating a windows installer for a dll which I developed in VS2019. The installer is created and works correctly on my machine, but not on other machines. The reason for this is that all registry values named 'CodeBase' have the wrong path to the dlls. It is not the installation directory but the release directory of my VS project.
I tried
"C:\Program Files (x86)\WiX Toolset v3.11\bin\heat.exe" dir "$(TargetDir.TrimEnd('\\'))" -suid -sfrag -srd -gg -g1 -cg EA<my project name>Assemblies -var var.$(ProjectName).TargetDir -wixvar -dr INSTALLFOLDER -out "$(ProjectDir)WIX\$(TargetName).wxs"
where INSTALLFOLDER is defined in the 'Product.wxs'
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="my product name" />
</Directory>
</Directory>
</Fragment>
The CodeBase regitry value lines in the generated XIX file all are looking like this:
<RegistryValue Root="HKCR" Key="CLSID\{41D3DB26-8261-303B-ACAF-F4F823FE21BE}\InprocServer32\3.1.1.0" Name="CodeBase" Value="file:///C:/Dev/C#/<my VS project path>/bin/Release/Microsoft.AspNetCore.Http.Features.dll" Type="string" Action="write" />
As you can see, the created path is not the target directory (which is C:\Program Files (x86)\my product name) but the release directory of my VS project.
I also tried replacing INSTALLFOLDER by TARGETDIR and adding the parameter -directoryid TARGETDIR (resp. INSTALLDIR) in the call of heat.exe, but nothing changed.
So I hope that I find someone here who can tell me, what I'm doing wrong. I'd appreciate any help. If you need more information, please tell me. I'm using heat version 3.11.1.2318 with VS2019 on Win10.
I apologize for the anonymization of my product but it is not my property and for now I'm not allowed to publish it.
Jörg
It's sad to have to say so but for me the only solution was to change to another technology and use a visual studio installer project template (imho. much easier to handle) to create my installer.
Related
I am writing a simple code to install a file in the Program Files folder, NOT Program Files (x86)
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="Del">
<Directory Id="MyFolder" Name="MyFolder"/>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment>
<Component Id="Component1" Directory="MyFolder" Win64="yes">
<File Id="FirstFile.txt"/>
</Component>
</Fragment>
Basically it should create a folder del in Program Files and in it, it should create folder MyFolder which would contain FirstFile.txt
If I do it for Id = ProgramFilesFolder , it works by installing in Program Files (x86)
Changing it to ProgramFiles64Folder gives the following error
ICE80: This package contains 64 bit component 'Component1' but the Template Summary Property does not contain Intel64 or x64.
My Question is from where or how can I change the Template Summary property ?
Thanks in Advance
Arnson's Approach: Do check out the answer from Bob Arnson. Here is an extract from his blog: "It’s typical to want to produce both 32-bit and 64-bit packages from the same WiX source, so a common approach is to make the #Win64 attribute value a preprocessor variable." Hence he uses a compiler switch to compile either x32 or x64-bit version MSI files from the same source.
And no: you can not support both with architectures with one MSI. See this blog from Heath Stewart: Different Packages are Required for Different Processor Architectures.
"Hard Coded" Way: Here is an old sample you can try:
https://github.com/glytzhkof/WiXBitnessX64
Some extracts:
Package element:
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64" />
Component element:
<Component Feature="ProductFeature" Win64="yes">
<File Source="$(env.SystemRoot)\notepad.exe" />
</Component>
From https://www.joyofsetup.com/2010/05/14/working-hard-or-hardly-working/#manually-marking-package-and-component-bitness:
Specify the -arch switch at the candle.exe command line or the InstallerPlatform property in a .wixproj MSBuild project. When you specify x64 or intel64, Candle automatically sets the package and components in the file being compiled as 64-bit.
In my WIX project i do have BuildVersion variable read from .exe file of my application. Lets say currently its 1.0.0.0. General idea is to allow users to install multiple version of application on single pc. There are 2 problems:
How to create .msi output files with version information in its name ? For example Application_v1.0.msi. To be honest i have no idea where to even start with that.
How to create separate folders for each version in Start menu, and Program files ? Idea is to have structure like Application/v1-0 (v2-0, v3-1 ..generaly v[major]-[minor]) in both - start menu and Program files.
According to point 2 so far i tried something "simple", like this in localisation file:
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="ProductNameFolder">MyApp\[BuildVersion]</String>
And then in file where i do have "directory" section:
<Directory Id="TARGETDIR" Name="SourceDir">
<!-- Shortcut folder is a Start Menu Folder-->
<Directory Id="ProgramMenuFolder">
<Directory Id="InstallProgramMenuFolder" Name="!(loc.ProductNameFolder)" />
</Directory>
<?if $(var.Platform)=x86 ?>
<!-- Program Files folder-->
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="!(loc.ProductNameFolder)" />
</Directory>
<?else?>
<!-- Program Files (64 bit) folder-->
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="!(loc.ProductNameFolder)" />
</Directory>
<?endif?>
</Directory>
But when im trying to build im getting errors Invalid DefaultDir string everywhere where im using loc.ProductNameFolder.
I have tried also something like that in Directory section:
<Directory Id="InstallProgramMenuFolder" Name="!(loc.ProductNameFolder)\$(var.BuildVersion)" />
But that does give me errors like:
The Directory/#Name attribute's value '!(loc.PoductNameFolder)\1.0.0.0', is not a valid long name because it contains illegal characters
General idea is to have folder name like v[major]-[minor] but at start im trying simple version=folder name concept. No idea how i could convert Version to v[major]-[minor] so far as well.
Im using WIX Toolset 3.11.2, and Visual Studio 2019 Extension.
My own "partial" solution for point 1 - instalation file name with version:
Unload project, add something like this in BeforeBuild section :
get buildversion:
<GetAssemblyIdentity AssemblyFiles="..\src\MyApp\bin\Debug\MyApp.exe">
<Output TaskParameter="Assemblies" ItemName="AssemblyVersion" />
</GetAssemblyIdentity>
Create custom .msi name with version:
<CreateProperty Value="MyAppInstaller_v%(AssemblyVersion.Version)">
<Output TaskParameter="Value" PropertyName="TargetName" />
</CreateProperty>
In result you will get something like MyAppInstaller_v1.0.0.0. Still i would need to convert it to MyAppInstaller_v1.0
Wix developers!
Is it possible to specify random name for install directory name with the help of property or vbscript custom action?...
I have the following Product.wxs:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="Client">
<Component Id="ProductComponent">
<File Id="File001" Source="..\Release\One.dll" />
</Component>
...
It is prepare install directory like:
C:\Program Files(x86)\Client
I need like this
C:\Program Files(x86)\234wfdasdqaw
where "234wfdasdqaw" random string which generated in every case when
a) run msi for installation
b) and if admin is not set the INSTALLLOCATION via command line.
Is it possible?
thank you.
You'll need a custom action to randomly generate the string and then a type 51 (set property) custom action to set INSTALLLOCATION to a computed value if 1) it doesn't already have a value and 2) the product isn't already installed. I would not do this in the root of ProgramFilesFolder as that would be very messy. At least do it in [ProgramFilesFolder]Company or [ProgramFilesFolder]Product. Your question makes me wonder if you plan on installing this MSI more then once. Be aware that it takes special tricks to install an MSI multiple times.
I've created a VSIX package that I install via a WIX-generated MSI.
However, when I install it, and look at it in VS2010, in the Tools > Extension Manager menu, it is [Disabled] and I need to enable it manually.
How can I avoid this?
** EDIT **
Here's what I did:
I tried adding capturing the VSInstallDir from the registry like this:
<Property Id="VSINSTALLER">
<RegistrySearch Id="VSInstallRegistry" Root="HKLM" Key="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0" Name="InstallDir" Type="directory" />
I added the directory structure under target-dir like this:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="VSINSTALLER">
<Directory Id="Extensions" Name="Extensions">
<Directory Id="Copy_CompanyFolder" Name="my company">
<Directory Id="INSTALLVSIX" Name="app name">
</Directory>
</Directory>
</Directory>
</Directory>
And I added a CopyFile element to the component in the installation folder, like this:
<Component Id="VsPackage" Guid="00000000-0000-some-guid-00000000">
<File Id="VsPackageInstaller" Source="$(folder.prop)\extensionName.vsix"
KeyPath="yes" DiskId="1">
<CopyFile Id="Copy_InstallVsix"
DestinationDirectory="INSTALLVSIX" />
</File>
</Component>
And I added the true element to the manifest.
When I do this, the extension is not installed.
Any ideas why?
If you install your extension files to a directory you create under %VSInstallDir%\Common7\IDE\Extensions, it will be enabled automatically for all users. This is the recommendation for MSI-installed extensions.
Also, please be sure to add <InstalledByMsi>true</InstalledByMsi> to your vsixmanifest.
There is no need to run VSIXInstaller.exe or write registry keys to enable your extension (In fact, you really shouldn't do this.).
Use "VSIXInstaller.exe" tool from VS2010\Common7\IDE.
Also you can manually enable your extension by adding registry value to
HKCU\Software\Microsoft\VisualStudio\10.0Exp\ExtensionManager\EnabledExtensions
I have a WiX 3 project that has hundreds of files, and I can't seem to figure out how to include them all using a wildcard. I have tried this:
heat.exe" dir ".\!Build" -gg -ke -template:fragment -out "Files.wxs"
This produces a fragment .wxs file, but I'm not sure what to do with it. Any help would be much appreciated.
Try this command
heat dir "Your_Directory" -gg -ke -template:Product -out "Files.wxs"
It will create this structure in the generated wxs file {Files.wxs}:
<Fragment>
<DirectoryRef Id="Files">
<Component Id="Test.ico" Guid="{YOUR_GUID}">
<File Id="Test.ico" Name="Test.ico" KeyPath="yes" Source="..[path to file]\Test.ico" />
</Component>
</DirectoryRef>
</Fragment>
You should get one for each file, that was in the directory that you ran heat against. Once that is done, you just have to add the wxs file to your project, make sure you have the directory that the directoryref points to is created.