WiX 3.7 and MATLAB 2012a MCR - matlab

Is there tutorial for creating a WiX installer, that can check if MCR is already installed and if not can install it?
I'm working with Visual Studio 2012.

Here's my solution for MCR 2012a and .NET 4.5 please comment if there is a better way to do it:
this is for documentation
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:netfx='http://schemas.microsoft.com/wix/NetFxExtension'>
<Bundle Name="MYAPP"
Version="0.6"
Manufacturer="MY Corporation"
UpgradeCode="f380ae43-5df1-4cfe-9297-526e3e638e57">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef
Id="Netfx45FullPackage"/>
</Chain>
</Bundle>
<Fragment>
<util:RegistrySearch
Id="MatlabPath"
Variable="UniqueId"
Root="HKLM"
Key="SOFTWARE\Matworks\MATLAB\4.17\"
Result="exists"/>
<PackageGroup Id="Netfx45FullPackage">
<ExePackage
Id="Netfx45Xxx"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="no"
InstallCommand="/q"
SourceFile="..\SetupProject\dotnetfx45_full_x86_x64.exe"
DetectCondition="(Netfx4FullVersion="4.5.50709") AND (NOT VersionNT64 OR (Netfx4x64FullVersion="4.5.50709"))"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0) AND (NOT (Netfx4FullVersion="4.5.50709" OR Netfx4x64FullVersion="4.5.50709"))"/>
<ExePackage
Id="MatlabMCR2012a64"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="no"
InstallCommand="/q"
SourceFile="..\SetupProject\MCR_R2012a_win64_installer.exe"
InstallCondition="(NOT MatlabPath)"/>
<MsiPackage
Id="MYAPP"
Cache="no"
Compressed="no"
Vital="yes"
SourceFile="..\SetupProject\bin\Release\MYAPPSetup.msi"/>
</PackageGroup>
</Fragment>
</Wix>

Related

How to pack an x86 / x64 specific C++/CLI DLL with Nuget?

I have a C++/CLI DLL that interfaces a third party native DLL. I want to pack this as Nuget.
I followed this official MS guide, this blog post and read through this other question.
So here is what I did:
First, I created the proper nuspec file:
<?xml version="1.0"?>
<package >
<metadata>
<id>CPlusPlusNativeIFace</id>
<version>1.0.4</version>
<title>CPlusPlusNativeIFace</title>
<authors>Jens Rabe</authors>
<owners>Who owns that</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A DLL that makes a native third-party DLL available to .net</description>
<releaseNotes>foo</releaseNotes>
<copyright>errm...</copyright>
<tags>foo bar</tags>
</metadata>
<files>
<file src="..\Release\**" target="runtimes/win-x86/lib/net461" />
<file src="..\x64\Release\**" target="runtimes/win-x64/lib/net461" />
<file src="DummyAny\**" target="ref\net461" />
</files>
</package>
Then I compiled the DLL for Release x86 and Release X64. Then I created the DummyAny folder, copied the contents of the x86 one in, and used the corflags utility like in Links 2 and 3 to strip the 32 bit flag.
When I now nuget pack and nuget add, and try to reference that package in another project, I always get:
Could not install package 'CPlusPlusNativeIFace 1.0.4'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I double checked that the files are right:
I have the x86 stuff in runtimes/win-x86/lib/net461
I have the x64 stuff in runtimes/win-x64/lib/net461
I have a ref/net461 folder with the manipulated dll in
But I still can't load the package.
I also tried putting the CPU specific DLLs into runtimes/win-x86/native and runtimes/win-x64/native to no avail.
What else am I missing? Does that not work for C++/CLI projects built against .net Framework?
Turned out that the official MS documentation was not usable here.
This question was/is listed as "related" here and the accepted answer there made it work for me. I used the example project on Github as a reference.
So here is how I got it to work:
Opened the project properties, went to Configuration Properties / General, selected All Configurations and All Platforms, and as Output Directory, I specified: $(ProjectDir)bin\$(Platform)\$(Configuration)\
Rebuilt the project for x86 and x64 in Release mode
Adapted the Nuspec to be like this:
<?xml version="1.0"?>
<package >
<metadata>
<id>CPlusPlusNativeIFace</id>
<version>1.0.5</version>
<title>Third Party Proxy</title>
<authors>Jens Rabe</authors>
<owners>foo</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>bar</description>
<releaseNotes>Further experimenting with nuget</releaseNotes>
<copyright>baz moo</copyright>
<tags>quux bletch</tags>
</metadata>
<files>
<file src="bin\Win32\Release\**" target="build\x86" />
<file src="bin\x64\Release\**" target="build\x64" />
<file src="bin\Win32\Release\**" target="lib\net461" />
<file src="CPlusPlusNativeIFace.props" target="build\net461" />
</files>
</package>
Added a CPlusPlusNativeIFace.props which contains the following:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Reference Include="CPlusPlusNativeIFace" Condition="'$(Platform)' == 'x86'">
<HintPath>$(MSBuildThisFileDirectory)..\x86\CPlusPlusNativeIFace.dll</HintPath>
</Reference>
<Reference Include="CPlusPlusNativeIFace" Condition="'$(Platform)' == 'x64'">
<HintPath>$(MSBuildThisFileDirectory)..\x64\CPlusPlusNativeIFace.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
Now I can do nuget pack CPlusPlusNativeIFace.nuspec and I get a Nuget package that installs correctly.

MSI installer - invoke PowerShell script

I have a blocker in MSI installer package creation, please find the below details and let me know if any solutions,
I have written PowerShell script to automate the Hyper-V virtual machine provision ( AWS i3.metal instance type ) and the script is working fine.
I wants that PowerShell script as MSI installer package
Working in visual studio 2017 community version to make MSI installer package
For that I used WIX installer commands and created wxs file to make MSI
Successfully created MSI installer using WIX but while installing that MSI, it’s not invoking PowerShell script
But I could see that application installed ( listed in control panel & installation folder is created in C:\programFiles)
Used wix SetProperty, CustomAction & InstallExecuteSequence cmd but no luck with invoking Powershell script
This is for a new Windows server
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="19fe6e20-a840-4829-8883-bde0bfa51d4c" Name="testing" Language="1033" Version="1.0.0.0" Manufacturer="muni" UpgradeCode="93008c8b-adb9-4498-8be2-4a83162b3a35">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="test" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="C:\Users\Administrator\source\repos\testMSI\test\Invoke-Test.ps1" Id="InvokeTestPS1" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="testing" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Guid="*">
<File Id="InvokeTestPS1" Source="Invoke-Test.ps1" />
</Component>
</DirectoryRef>
<Property Id="POWERSHELLEXE">
<RegistrySearch Id="POWERSHELLEXE"
Type="raw"
Root="HKLM"
Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
Name="Path" />
</Property>
<Condition Message="This application requires Windows PowerShell.">
<![CDATA[Installed OR POWERSHELLEXE]]>
</Condition>
<SetProperty Id="InvokeTestPS1"
Before="InstallFinalize"
Sequence="execute"
Value =""[POWERSHELLEXE]" -Version 2.0 -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "& '[#InvokeTestPS1]' ; exit $$($Error.Count)"" />
<CustomAction Id="InvokeTestPS1"
BinaryKey="WixCA"
DllEntry="WixSilentExec"
Execute="immediate"
Return="check"
Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action="InvokeTestPS1" After="InstallFinalize">
<![CDATA[NOT Installed]]>
</Custom>
</InstallExecuteSequence>
</Fragment>
<Fragment>
<Feature Id="Application" Title="Minefold" Level="1">
<ComponentRef Id="ProductComponent" />
</Feature>
</Fragment>
</Wix>
MSI installer should invoke Powershell script - Means once i created MSI then i need to install that MSI and MSI need to invoke the powershell script

Wix window service only copy exe file in installation folder not all dependencies

I am new in wix and creating a window service. I have created my service and successfully added in window service but when I run it stopped due to error.
<?xml version="1.0" encoding="UTF-8"?>
<?define Name = "New Window Service" ?>
<?define Manufacturer = "GAT" ?>
<?define UpgradeCode = "{0d4fb541-bb66-4df8-bdab-893564e191fc}" ?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"
>
<Product Id="*" Name="$(var.Name)" Manufacturer="$(var.Manufacturer)" Version="1.0.0.0" UpgradeCode="$(var.UpgradeCode)" Language="1033">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Media Id="1" Cabinet="GAT.GATAC.ServiceLayer.WindowsServiceHost.cab" EmbedCab="yes" />
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
<Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="$(var.GAT.GATAC.ServiceLayer.WindowsServiceHost.TargetFileName)">
<CreateFolder />
<File Id="$(var.GAT.GATAC.ServiceLayer.WindowsServiceHost.TargetFileName)" Source="D:\Projects\GATAC\GAT.GATAC.ServiceLayer.WindowsServiceHost\bin\Release\GAT.GATAC.ServiceLayer.WindowsServiceHost.exe" KeyPath="yes" Vital="yes" />
<File Id="GAT.GATAC.ServiceLayer.WindowsServiceHost.exe.config"
Name="MyProduct.exe.config"
Source="D:\Projects\GATAC\GAT.GATAC.ServiceLayer.WindowsServiceHost\bin\Release\GAT.GATAC.ServiceLayer.WindowsServiceHost.exe.config"
Vital="yes"
KeyPath="no"
DiskId="1" />
<RemoveFile Id="ALLFILES" Name="*.*" On="both" />
<util:XmlFile Id="ModifyServiceLocation" Action="setValue" ElementPath="/configuration/connectionStrings/add[\[]#name='DefaultConnection'[\]]/#connectionString" File="D:\Projects\GATAC\GAT.GATAC.ServiceLayer.WindowsServiceHost\bin\Release\GAT.GATAC.ServiceLayer.WindowsServiceHost.exe.config" Value="Data Source=[DB_SERVER];Initial Catalog=[DB_DATABASE];User Id=[DB_USER];Pwd=[DB_PASSWORD]"/>
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Name="GAT.GATAC.ServiceLayer.WindowsServiceHost"
DisplayName="$(var.Name)"
Description="A Test Service that logs dummy text on an interval to a text file."
Start="auto"
ErrorControl="normal"
/>
<ServiceControl Id="ServiceInstaller"
Stop="both"
Remove="both"
Name="GAT.GATAC.ServiceLayer.WindowsServiceHost"
Wait="yes" />
</Component>
</DirectoryRef>
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="$(var.GAT.GATAC.ServiceLayer.WindowsServiceHost.TargetFileName)" />
</Feature>
</Product>
</Wix>
when I saw in installation folder of service there is only exe file so how to copy all dependencies of window service in this folder my code is following.When I copy files manually in installation folder it works.Do I need to harvest
Yes, you need to include ALL files in your wxs as components you want to install.
If you have a few dependencies, you can just add them as File components yourself. If there are a lot of files consider using heat to generate the wxs file for you and you can copy the file elements into your wxs code. If the file dependencies may change frequently, consider using heat to always generate the wxs and include it as a linked file in your main installer project.
Ideally all your dependencies are being included in the GAT.GATAC.ServiceLayer.WindowsServiceHost project's bin folder so you can just use $(var.GAT.GATAC.ServiceLayer.WindowsServiceHost.TargetDir)DependencyFileName as the Source for the file.

What's the correct way to author a NuGet package that must add references to older framework assemblies?

I'm trying to author a NuGet package that can be added into a .net 4.0 or 4.5 project. The actual assemblies contained in the package are all built against .net 3.5, all except one which is built against .net 4.0 - I have no control over this so I have to use the assemblies 'as is'.
The project I'm working on targets .net 4.5.2 and needs to have these 'legacy' assemblies referenced. I have enabled 'legacy runtime activation' by having the following in my App.config:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
This all seems to work well enough. Now, I wish to package my 'legacy' assemblies into a NuGet package. My .nuspec file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<!-- many lines elided for clarity -->
<references>
<group>
<reference file="NetFx35Assembly1.dll" />
<reference file="NetFx35Assembly2.dll" />
</group>
<group targetFramework=".NETFramework4.5.2" >
<reference file="NetFx40Assembly.dll" />
</group>
</references>
</metadata>
<files>
<!-- .net 3.5 assemblies -->
<file src="NetFx35Assembly1.dll" target="lib\net35\NetFx35Assembly1.dll" />
<file src="NetFx35Assembly2.dll" target="lib\net35\NetFx35Assembly2.dll" />
<!-- .net 4.0 assemblies -->
<file src="NetFx40Assembly.dll" target="lib\net40\NetFx40Assembly.dll" />
</files>
</package>
My expectation was that when I added this package to my .net 4.5.2 project, it would do the following:
Reference the 3.5 assemblies, because they are in a 'default' group that doesn't specify any framework
Reference the 4.0 assembly, because it is specified in a group that targets 4.5.2
Things did not work out as I expected. What I actually got was a single reference to the 4.0 assembly.
What is the correct way to author the behaviour that I want? How can I make the NuGet package ensure that the <startup useLegacyV2RuntimeActivationPolicy="true"> tag is present in the App.config file?
For groups of references NuGet will install all items for one group only. It does not install the group without any framework specified if there is a more specific match. This default group is used if there are no other matches for the project's target framework.
Also I would probably not explicitly target .NET 4.5.2 in the NuGet package unless the .NET 4.0 assemblies target .NET 4.5.2 only. If they are compatible with .NET 4.0 I would have them target .NET 4.0
<group targetFramework="net35">
<reference file="NetFx35Assembly1.dll" />
<reference file="NetFx35Assembly2.dll" />
</group>
<group targetFramework="net40" >
<reference file="NetFx35Assembly1.dll" />
<reference file="NetFx35Assembly2.dll" />
<reference file="NetFx40Assembly.dll" />
</group>
Note the above is equivalent to not having the references defined in the metadata section and just using:
<files>
<!-- .net 3.5 assemblies -->
<file src="NetFx35Assembly1.dll" target="lib\net35" />
<file src="NetFx35Assembly2.dll" target="lib\net35" />
<!-- .net 4.0 assemblies -->
<file src="NetFx35Assembly1.dll" target="lib\net40" />
<file src="NetFx35Assembly2.dll" target="lib\net40" />
<file src="NetFx40Assembly.dll" target="lib\net40" />
</files>
For the app.config file I would look at using an XML document transform to add the startup element.

How Eclipse check available plugin in some environment?

I made some Eclipse plugin and update site on Indigo(Eclipse v3.7).
I can debug my plugin with new Eclipse instance, but I can't install my plugin via update site.
When I try to test install my plugin with Indigo (same environment as dev environment), the install wizard says:
Cannot complete the install because some dependencies are not satisfiable
com.mytest.helloworld.feature.group [1.0.0.201203071543] cannot be installed in this environment because its filter is not applicable.
(I tried to install my plugin with the same version of eclipse - Indigo.
And, My plugin works fine after manual install.)
Is there any check point to solve this?
How eclipse check available plugin? (based on what information?)
Here is my features.xml.
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.mytest.helloworld"
label="mytest Feature"
version="1.0.0.qualifier"
provider-name="mytest.com"
plugin="com.mytest.helloworld"
os="aix,hpux,linux,macosx,qnx,solaris,win32"
ws="carbon,cocoa,gtk,motif,photon,win32,wpf"
nl="en,ko"
arch="ia64,ia64_32,PA_RISC,ppc,sparc,x86,x86_64">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<url>
<update label="mytest update" url="http://localhost:8088/plugin"/>
</url>
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.expressions" version="3.4.101" match="greaterOrEqual"/>
<import plugin="com.android.ide.eclipse.adt" version="0.9.5" match="greaterOrEqual"/>
<import plugin="org.jdom" version="1.1.1" match="greaterOrEqual"/>
<import plugin="org.apache.commons.httpclient" version="3.1.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.jdt.core" version="3.5.2" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.resources" version="3.5.2" match="greaterOrEqual"/>
</requires>
<plugin
id="com.mytest.helloworld"
os="aix,hpux,linux,macosx,qnx,solaris,win32"
ws="carbon,cocoa,gtk,motif,photon,win32,wpf"
nl="en,ko"
arch="ia64,ia64_32,PA_RISC,ppc,sparc,x86,x86_64"
download-size="1000"
install-size="1000"
version="0.0.0"
unpack="false"/>
<plugin
id="com.mytest.helloworld.nl1"
os="aix,hpux,linux,macosx,qnx,solaris,win32"
ws="carbon,cocoa,gtk,motif,photon,win32,wpf"
nl="en,ko"
arch="ia64,ia64_32,PA_RISC,ppc,sparc,x86,x86_64"
download-size="1"
install-size="1"
version="0.0.0"
fragment="true"
unpack="false"/>
</feature>
Have you been able to run the plugin in a new Eclipse instance from your development environment? I.e press the run button and start a new Eclipse application with your plugin active.
It seems like there is some issue with filters, either you have defined a version requirement that doesnt work, or perhaps defined an OS that doesnt work. Posting your feature.xml might help.
Edit based on comment:
Try to remove the OS specific parts from the XML, i.e the properties "os", "ws", "arch" and perhaps "nl".
You would get
<feature
id="com.mytest.helloworld"
label="mytest Feature"
version="1.0.0.qualifier"
provider-name="mytest.com"
plugin="com.mytest.helloworld">
You only need to enter those properties if you are restricting the choice in some way, that is, your plugin contains OS specific code that will only work on some operating systems/architectures.