Include .exe file when deploying wpf application - c#

I'm creating a WPF application that uses also the Kinect 2. Now it's time to publish my application and I would like to create a unique setup file that installs the application and the Kinect SDK. I have the Kinect .exe and I would like to include it in the standard setup I create with the publish option in Visual studio (btw I'm using Visual Studio 2017).
Reading some stuff I figure out that the right way could be to insert the Kinect SDK in the prerequisites of my application. Right?
Thus I'm trying to add the file, following these guides:
How to: Create a Package Manifest
How to: Create a Product Manifest
I have created a folder in C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages, I have added the product xml file:
<?xml version="1.0" encoding="utf-8" ?>
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Custom.Bootstrapper.Package">
<PackageFiles>
<PackageFile Name="KinectRuntime-v2.0_1409-Setup.exe"/>
</PackageFiles>
<Commands>
<Command PackageFile="KinectRuntime-v2.0_1409-Setup.exe" Arguments="">
<InstallConditions>
<BypassIf Property="IsMsiInstalled"
Compare="ValueGreaterThan" Value="0"/>
<FailIf Property="AdminUser"
Compare="ValueNotEqualTo" Value="True"
String="NotAnAdmin"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1641" Result="SuccessReboot"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" String="GeneralFailure"/>
</ExitCodes>
</Command>
Then in a subfolder called "en" I added the package xml file:
<Package xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
LicenseAgreement="SDKEula.rtf">
<PackageFiles>
<PackageFile Name="SDKEula.rtf"/>
</PackageFiles>
<!-- Defines a localizable string table for error messages. -->
<Strings>
<String Name="DisplayName">Update Consent Dialog</String>
<String Name="Culture">en</String>
<String Name="AU_Unaccepted">The automatic update agreement is not accepted.
</String>
<String Name="GeneralFailure">A failure occurred attempting to launch the setup.</String>
</Strings>
</Package>`
I also added the rtf file. So for me should be almost ok. But when I go back to VS I don't see this new package in the prerequisites list.
Can you help me to add the Kinect SDK installer?
Thank you very much,
Alex

Solved. I thought that the folder was right but instead looking in the key GenericBootstrapper I found that the packages' path was C:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper. Adding the new package with the product and package xml in the folder I'm able to see the Kinect Installer in the prerequisites. Publishing the APP everything works

Related

MSI Installer - conditional installation of prerequisites

I had a problem with SAP Crystal Reports SDK. It disappeared from web, so i had to create my own ClickOnce Bootstrapper package (for that I've used software called Bootstrap generator).
And its almost working as expected, it install SAP Crystal Report before installing main program.
The problem is that it is installing SAP Crystal Report everytime i run installer, even when its already installed.
It looks like my MSI installer doesnt detect that there is already installed version of SAP Crystal Report.
Product.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Product ProductCode="SAP.Crystal.reports.x86" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="crruntime_32bit_13_0_15.msi" PublicKey="3082010A0282010100A5F02AFCBAF295DD82C482B0AA83782A08EA007635AFE2E76B57558D6AD708A1C96B86DA81894CDBB42214C26674A5C7F233D8BC76C77B3B2CBC8E38033C3C9C26FC5CD0789A462A2A6B2B19AC9321C851A08544DBF42CE697C97B730964C159D533BA56B835B702AA3F30E96CFD76F60A555EBC862828347E468BF126B9EB345A7E488AEA3451E9E9EB8412A600D1DB811A2C0144697048CD41F100E10AB8225658E1C3B7613A06835E628E2556C0F8BFD1408A0A5FED97892F6B99F49F2F436A0293AA5562FBBD5EE89DC667261E058AA767E168867CEAC2081588C1BD800FC2BFCD98773CEFD3266F54EB0DC7DAF4D5CD1867EA897D39E6A289A4A75ECA890203010001" />
</PackageFiles>
<Commands Reboot="Defer">
<Command PackageFile="crruntime_32bit_13_0_15.msi">
<ExitCodes>
<DefaultExitCode Result="Success" String="Anunexpectedexitcodewasr" FormatMessageFromSystem="true" />
</ExitCodes>
</Command>
</Commands>
</Product>
Package.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Package Name="DisplayName" Culture="Culture" xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper">
<Strings>
<String Name="Culture">pl</String>
<String Name="DisplayName">SAP Crystal reports x86</String>
<String Name="Anunexpectedexitcodewasr">An unexpected exit code was returned from the installer. The installation failed.</String>
</Strings>
</Package>
Prerequsities properties:
If you want to check if a prerequisite is already installed, you will need to add 2 things to the product.xml file.
First thing is the product code, or registry key.
If you pick a product code you could add an MSI Install check, for example:
<InstallChecks>
<MsiProductCheck Property="CR32BitExists" Product="{9D52DBF3-229A-4723-BF31-C57C9C1D2A23}" />
<MsiProductCheck Property="CR64BitExist" Product="{8055CFEA-3871-4C76-A321-E32F63637CC4}" />
</InstallChecks>
Then you would have to add install conditions, for example (for x86):
<InstallConditions>
<BypassIf Property="CR32BitExists" Compare="ValueEqualTo" Value="1" />
<BypassIf Property="CR32BitExists" Compare="ValueGreaterThanOrEqualTo" Value="3" />
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
</InstallConditions>
Notice that CR32BitExists is declared in Install checks and is used in InstallConditions.
About used values (1,3) you can read about here:
https://learn.microsoft.com/en-us/windows/win32/msi/session-featurerequeststate
After modifying product.xml you need to rebuild your msi.
When you try to install it, it will look for mentioned product codes in Install Checks.
If it detects it installed in OS, it will bypass instalation.

Visual Studio Nuget Manager reports "unsupported" for the .NETStandard2.0 section of a custom Nuget

We have a .NetStandard2.0 project which is meant to be packaged into a nuget following the technique explained here:
https://stackoverflow.com/a/45004898/863651
with a nuspec file which looks like so:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<!-- https://stackoverflow.com/a/45004898/863651 we had to resort to employing a seperate nuspec -->
<!-- file because thats the canonical way to include more than one dlls into the resulting nuget -->
<metadata>
<id>$id$</id>
<tags>$tags$</tags>
<owners>$owners$</owners>
<version>$version$</version>
<authors>$authors$</authors>
<description>$description$</description>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<dependencies>
<group targetFramework=".NETFramework4.5">
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Newtonsoft.Json" version="12.0.1" exclude="Build,Analyzers" />
</group>
</dependencies>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System" targetFramework=".NETFramework4.5" />
<frameworkAssembly assemblyName="Microsoft.CSharp" targetFramework=".NETFramework4.5" />
</frameworkAssemblies>
</metadata>
<files>
<file src="bin\$config$\netstandard2.0\*.dll;bin\$config$\netstandard2.0\*.pdb;" target="lib\netstandard2.0\" />
</files>
</package>
As you can see there is a section targeting .NetStandard2.0. The nuget package is generated by our build server using the following msbuild scriptlet:
<MSBuild Projects="C:\path\to\foo.csproj" Targets="Clean;foo;" Properties="SkipRestoringNugetPackages=true;Configuration=Release;Platform=AnyCPU;" ToolsVersion="15.0" />
The resulting nuget package is getting pushed into a nuget server with the following specs:
NuGet.Server v2.10.3.0
When reviewing the package through Visual Studio 2017 Nuget Package Manager of a .Net4.8 project the following is displayed on the sidebar:
Why does it say "Unsupported" for the .NetStandard2.0 section? Other packages don't display something like that and I can't find see any typos in the xml of the nuspec.
I've just found your issue could be related to the version of Nuget.Server package since you don't use nuget pack command. With same nuget package, when I use Nuget.server 2.10.3, it displays unsupported, After I update the Nuget.server to 3.4.1, all works well now. Let me know if it helps:)
I made a package locally, when I try to consume it in VS all works well.
After I deploy same package to nuget server 2.10.3, it displays unsupported!
So if the issue occurs when you try to fetch the package from the server after you deploy to it. I think it's because the Nuget.Server package you use is too old! Updating the Nuget.Server package can help resolve this issue.

Error with Entity Framework after installing Windows Service with WIX

i created a Windows Servicec project with Visual Studio 2012, including Entity Framework 6 to connect to my database. I added a new WIX project to create an installation package.
If i run the project in debug mode (in local from Visual Studio), it works fine. But after installation, the service returns the followning error:
No connection string named 'MyEntities' could be found in the application config file.
i'm new with Windows Installation XML (WIX), and i have no idea how to resolve the issue.
i think that there is something wrong in the Product.wxs, or somewere in the WIX project...
here is the Product.wxs:
<?xml version="1.0" encoding="UTF-8"?>
<!-- The name of the product -->
<?define Name = "MyService" ?>
<!-- The manufacturer, for setup package publisher and folder info -->
<?define Manufacturer = "MyCompanyName" ?>
<!-- The version number of this setup package-->
<?define Version = "1.0.1" ?>
<!-- UpgradeCode must be unique and not changed once the first version of the program is installed. -->
<?define UpgradeCode = "{1240E0CD-B3D2-44A7-B064-11B3C0709D69}" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="$(var.Name)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)" Version="$(var.Version)" Language="1033">
<!-- Create a folder inside Talk Sharp called Test Service -->
<Package InstallerVersion="300" Compressed="yes"/>
<!-- Create a folder inside Talk Sharp called Test Service -->
<Media Id="1" Cabinet="ParodosService.cab" EmbedCab="yes" />
<!-- Allow upgrades and prevent downgrades -->
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
<!-- Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<!-- Create a folder inside program files called Talk Sharp -->
<Directory Id="ROOTDIRECTORY" Name="$(var.Manufacturer)">
<!-- Create a folder inside Talk Sharp called Test Service -->
<Directory Id="INSTALLFOLDER" Name="$(var.Name)" />
</Directory>
</Directory>
</Directory>
<!-- The files inside this DirectoryRef are linked to the Test Service directory via INSTALLFOLDER -->
<DirectoryRef Id="INSTALLFOLDER">
<!-- Create a single component which is the MyService.exe file -->
<Component Id="$(var.MyService.TargetFileName)">
<!-- Copies the ParodosService.exe file using the project reference preprocessor variables -->
<File Id="$(var.MyService.TargetFileName)" Source="$(var.MyService.TargetPath)" KeyPath="yes" />
<!-- Remove all files from the INSTALLFOLDER on uninstall -->
<RemoveFile Id="ALLFILES" Name="*.*" On="both" />
<!-- Tell WiX to install the Service -->
<ServiceInstall Id="ServiceInstaller"
Type="ownProcess"
Name="MyService"
DisplayName="$(var.Name)"
Description="A Test Service that logs dummy text on an interval to a text file."
Start="auto"
ErrorControl="normal" />
<!-- Tell WiX to start the Service -->
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="MyService" Wait="yes" />
</Component>
</DirectoryRef>
<!-- Tell WiX to install the files -->
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="$(var.MyService.TargetFileName)" />
</Feature>
</Product>
</Wix>
Any help would be appreciated...
thanks in advance.
No connection string named 'MyEntities' could be found in the application config file.
this means that no connections string named "MyEntity" was found. So, i assume that a .confg file is missing. Usually, the config file used by services to get this kind of informations is named "YourAppName.exe.config".
copy this file from your project folder to your installation folder /Program Files/Manufacturer/Name Folder.
you will resolve.

How to Combine WIX Setup Project with WIX Bootstrapper Project

I have a WIX Setup Project that includes my custom UI and a WIX Bootstrapper Project that includes prerequsites/dependencies in form of exe and Msi of my projects.
I want to combine them to make a single exe.
If i give reference of my WIX Setup project in Bootstrapper Project then it did not display my WIX UI. However it is able to successfully installed my setup msi and prerequisites.
<Bundle Name="Bootstrapper1" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="4056d930-16b2-44eb-a861-16db566ae44c">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<PackageGroupRef Id="Y"/>
<MsiPackage SourceFile ="$(var.BiodentifySetUp.TargetPath)" Compressed ="yes" />
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="Y">
<ExePackage Id="Y" DisplayName="software already install"
DownloadUrl="http://download.microsoft.com/download/5/6/2/562A10F9-C9F4-4313-A044-9C94E0A8FAC8/dotNetFx40_Client_x86_x64.exe"
Compressed="no" Cache="yes" PerMachine="yes" Permanent="yes"
Vital="yes" SourceFile=".\y.msi" InstallCommand="/passive /norestart" />
</PackageGroup>
</Fragment>
How can I merge them to make an exe?
what i beleive you want to do is to use single exe to install all dependencies and your own msi and show your own MSI UI when it comes time to install your .msi packageand if I am not wrong with then you simply need to add DisplayInternalUI='yes' to the MsiPackage elements you want to display.
For example:
<Chain>
...
<MsiPackage ... DisplayInternalUI='yes' />
</Chain>
and if it is like you want NO bootstrapper UI but only your MSI UI then there is no such bootstrapper application who will silently install your dependencies and will show your MSI UI.
Please clearly explain your requirement for better responses.

How to install visual studio 2010 setup project with MS Access database on a computer which is not having Office 2010 installed?

I am developing wpf application in C#. I have successfully created the setup project for wpf application in visual studio 2010. I have used MS Access 2010 as a database. It install fine on all computers. But on some computer there is no Microsoft Office installed and on some computer there is lower version of MS Office like MS Office 2003. When I install my application on these computers it gives me connectivity issues. Can you please tell me what should I need to do ? Should I need to include any prerequisite for MS Access 2010 in visual studio 2010 setup project ? If there is any which are they and how to include them ?
I had same problem but I have already created a Bootstrapper package for Microsoft Access Database Engine 2010. I've also included in this package x64 version of it. So it should work on 64 machine also. To include any Prerequisites you must have to add a Bootstrapper Package of that. After that you can get that in your Prerequisite list. That already you know I think. To build a Bootstrapper you need 2 manifest XML files. 1 is product.xml and another is package.xml right? I'm writing all the XML script below.
PRODUCT XML:
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="Access.Database.Engine.2010"
>
<!-- Defines list of files to be copied on build -->
<PackageFiles CopyAllPackageFiles="false">
<PackageFile Name="AccessDatabaseEngine.exe" HomeSite="http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine.exe" />
<PackageFile Name="AccessDatabaseEngine_x64.exe" HomeSite="http://download.microsoft.com/download/2/4/3/24375141-E08D-4803-AB0E-10F2E3A07AAA/AccessDatabaseEngine_x64.exe" />
</PackageFiles>
<RelatedProducts>
<DependsOnProduct Code="Microsoft.Net.Framework.2.0" />
</RelatedProducts>
<InstallChecks>
<MsiProductCheck Property="IsInstalled"
Product="{90140000-00D1-0409-0000-0000000FF1CE}"/>
</InstallChecks>
<Commands>
<Command PackageFile="AccessDatabaseEngine.exe"
Arguments='/passive'>
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<!-- ByPass if the Processor is not x86 -->
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel"/>
<!-- ByPass if we have installed -->
<BypassIf Property="IsInstalled" Compare="ValueGreaterThan" Value="0" />
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on Win95 -->
<FailIf Property="Version9x" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/>
<!-- Block install on NT 4 or less -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1641" Result="SuccessReboot"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
<Command PackageFile="AccessDatabaseEngine_x64.exe"
Arguments='/passive'>
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<!-- ByPass if the Processor is not x64 -->
<BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="AMD64"/>
<!-- ByPass if we have installed -->
<BypassIf Property="IsInstalled" Compare="ValueGreaterThan" Value="0" />
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on Win95 -->
<FailIf Property="Version9x" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/>
<!-- Block install on NT 4 or less -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1641" Result="SuccessReboot"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
PACKAGE XML:
<?xml version="1.0" encoding="utf-8" ?>
<Package
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
Name="DisplayName"
Culture="Culture"
LicenseAgreement="license.txt"
>
<PackageFiles>
<PackageFile Name="license.txt"/>
</PackageFiles>
<!-- Defines a localizable string table for error messages and url's -->
<Strings>
<String Name="DisplayName">Microsoft Access database engine 2010 (x86, x64)</String>
<String Name="Culture">en</String>
<String Name="DotNetFxRequired">Installation of Microsoft Access database engine 2010 requires Microsoft .NET Framework 2.0. Contact your application vendor.</String>
<String Name="InvalidPlatformWin9x">Installation of Microsoft Access database engine 2010 is not supported on Windows 95. Contact your application vendor.</String>
<String Name="InvalidPlatformWinNT">Installation of Microsoft Access database engine 2010 is not supported on Windows NT 4.0. Contact your application vendor.</String>
<String Name="GeneralFailure">A fatal error occurred during the installation of Microsoft Access database engine 2010.</String>
<String Name="AdminRequired">You do not have the permissions required to install this application. Please contact your administrator.</String>
</Strings>
</Package>
license.txt
For detail please Log on http://www.microsoft.com/en-us/download/details.aspx?id=13255
Note: I've already tested in my Windows 7 x86 Machine and it works perfect. It doesn't reinstall if already installed. I've no x64 machine so I don't know the Product code of it. But I'm sure it'll work too. It also downloads this package from website and I've tested that.
If you need any further help or complete Bootstrapper Package just let me know.
Cheers.
You migth be able to use
Microsoft Access Database Engine 2010 Redistributable
-- Update --
To add custom prerequisites you need to create a Bootstrapper Package here are some instructions:
Creating Bootstrapper Packages
Deploying Custom made Visual Studio prerequisites using Bootstrapper Manifest Generator
-- Update 2 --
For 64-bit implementations see comment from Massood Khaari below.

Categories