I am creating a custom bootstrapper which has a WPF UI.
First: the WPF user interface will display.
Second: when I click the install button, the MsiPackage will execute, the internal UI will display because I set DisplayInternalUI to yes
Everything is OK, but it has a problem. The internal UI displays behind the custom WPF UI.
How do I set the internal UI to display at the top of window?
I tried to minimize the WPF UI when I click the Install button. Yes, the WPF UI will minimized, and seconds later the internal UI also... It shows with the minimized window state too.
My bundle.wxs:
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<PayloadGroupRef Id="InstallerPayload"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef Id="NetFx40Full"/>
<PackageGroupRef Id="InstallerPackages"></PackageGroupRef>
</Chain>
</Bundle>
<Fragment>
<PayloadGroup Id="InstallerPayload">
<Payload SourceFile="..\CustomBootstrapper\bin\release\MahApps.Metro.dll"/>
<Payload SourceFile="..\CustomBootstrapper\bin\release\System.Windows.Interactivity.dll"/>
<Payload SourceFile ="..\CustomBootstrapper\bin\release\CustomBootstrapper.dll"/>
<Payload SourceFile="..\CustomBootstrapper\BootstrapperCore.config" />
<Payload SourceFile="C:\Program Files (x86)\WiX Toolset v3.7\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
</PayloadGroup>
</Fragment>
<Fragment>
<PackageGroup Id="InstallerPackages">
<!-- <MsiPackage Id="CRMInstall"
Vital="yes"
Name="Packages\SetupProject1.msi"
SourceFile="Packages\SetupProject1.msi"
DisplayInternalUI="yes"> -->
<MsiPackage Id="CRMInstall"
Vital="yes"
Name="Packages\StandardSetup.msi"
SourceFile="..\StandardSetup\bin\Release\StandardSetup.msi"
DisplayInternalUI="yes">
</MsiPackage>
</PackageGroup>
</Fragment>
..
..
When you call Engine.Apply() make sure you pass the handle to the WPF Window that is being displayed. It should go something like:
var mainWindowHandle= new WindowInteropHelper(mainWindow).EnsureHandle();
Engine.Apply(mainWindowHandle);
Where mainWindow is class that inherits from the WPF Window class.
Related
I wrote a Boostrapper UI in C# for Net Framework 2.0 using Win-Forms. It started working fine and designed forms are responding as expected.
Here is my Wix Bundle Code:
<?define TargetFile=$(var.MyBA.TargetDir)$(var.MyBA.TargetFileName)?>
<?define BootstrapConfigFile=$(var.MyBA.ProjectDir)BootstrapperCore.config?>
<Bundle Name="Bootstrapper1" Version="1.0.0.0" Manufacturer="Farrukh" UpgradeCode="54c4a4a4-dca8-4ae4-b2f4-5e3f3fd8cb92">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<Payload SourceFile="$(var.BootstrapConfigFile)"/>
<Payload SourceFile="$(var.TargetFile)"/>
<Payload SourceFile="$(env.WIX)\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
</BootstrapperApplicationRef>
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
<Chain>
<!--<PackageGroupRef Id='Netfx4Full' />-->
<MsiPackage Id="MyInstaller"
Cache="no"
Visible="yes"
DisplayInternalUI="yes"
SourceFile="MyProduct.msi"
/>
</Chain>
</Bundle>
As you can see that it doesn't include NetFX package and as it requires Net-Framework 2.0, I experimented with renaming the Net Framework registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup-Renamed
and 32 bit
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup-Renamed
so that it won't be able to detect it. This resulted in displaying a very basic UI: i.e.
I believe , this was displayed due to following markups in my Bundle, but I'm not sure about that
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
However, when I clicked "Accept and Install" nothing happened and buttons just got disappeared. That may be because I added no NetFx Package, neither any reference to WixNetFxExtension. (And I will definitely gonna add these and will see results later).
Question: I want to edit this basic UI so if my user try to install it on Windows XP (with no Net Framework), he/she would get the UI as I will design, not this basic one. So how can I edit this basic UI?
I feel, I'm missing some basic thing here, but need some guidance.. would really appreciate any help/guidance.
Regards
I was able to solve this after finding a thread on Wix User's mailing list. Here it is:
customizing burn prerequisite boostrapper image in theme
So this screen is known as Burn Prerequisite and it has a special WixVariable ID. Here is code from my Bootstrapper, depicting the use of my own custom theme for Burn's pre-req screen:
<WixVariable Id="PreqbaThemeXml" Value="..\resources\MbaPrereqTheme.xml" />
<WixVariable Id="PreqbaThemeWxl" Value="..\resources\MbaPrereqTheme.wxl" />
And any resources like Logo.png, Banner.bmp and NetfxLicense.rtf etc which you have referenced in MbaPrereqTheme.xml, would have to be part of Bootstrapper as a PayLoad:
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >
<Payload SourceFile="$(var.BootstrapConfigFile)"/>
<Payload SourceFile="$(var.MyBootstrapDll)"/>
<Payload SourceFile="$(env.WIX)\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
<!-- Following are required as payload and to be used by Pre-Req screen.-->
<Payload SourceFile="..\resources\logo.png"/>
<Payload SourceFile="..\resources\Banner.bmp"/>
<Payload SourceFile="..\resources\NetfxLicense.rtf"/>
</BootstrapperApplicationRef>
And this started working just like as I wished :).
Regards
I have created an working WiX Patch but during it's installation it does not show the product background image.
The original product setup dialog shows the images and they are defined in it's project like:
<Product ...>
<WixVariable Id="WixUIBannerBmp" Value="gn_setup_dialog_banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="gn_setup_dialog.bmp" />
The patch is created and works fine. The problem is that it does not show these images. It shows some default background for the dialog.
Here is my patch if this helps:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Patch AllowRemoval='yes'
Manufacturer='xxx'
MoreInfoURL='...'
DisplayName='...'
Description='Small Update Patch'
Classification='Update'
Codepage="...">
<Media Id='5000' Cabinet='RTM.cab'>
<PatchBaseline Id='RTM' />
</Media>
<PatchFamily Id="HotFixPatchFamily" Version="1.0.1.0" Supersede="no" />
</Patch>
</Wix>
Thanks for helping.
For some reason the patch was delivering these two files as "new" ones...even tough they were not changed.
Anyway, I solved the problem by replacing the stock Wix dialog images, like it is suggested here (at bottom "Replacing the stock bitmaps"):
http://wix.sourceforge.net/manual-wix2/WixUI_dialog_library.htm
i'm developing a Visual Studio 2010 extension, i already have a toolbar inside my window. on that toolbar i have a button that i want to give an icon - my own icon!
I've read this article and it is great but... it explains how to replace the icons.
i want to add an additional icon.
how do i achieve that?
First, add the bitmap and set its build action to Resource
Remember, shocking pink = transparent (damn you, old school!)
Then, in your vsct file, add the image to the bitmaps section
<Bitmaps>
<Bitmap guid="AddSampleData.bmpGuid"
href="..\Button Bitmaps\AddSampleData.bmp"
usedList="AddSampleData.bmpId" />
<Bitmap guid="ApplySampleData.bmpGuid"
href="..\Button Bitmaps\ApplySampleData.bmp"
usedList="ApplySampleData.bmpId" />
</Bitmaps>
and assign it a guid in the symbols node
<Symbols>
<!-- snip -->
<GuidSymbol name="AddSampleData.bmpGuid"
value="{dcae7c84-8e91-4f8a-907b-95ccb0f52e6e}">
<IDSymbol name="AddSampleData.bmpId"
value="1" />
</GuidSymbol>
<GuidSymbol name="ApplySampleData.bmpGuid"
value="{9f555245-2430-4e6f-992b-b49ce87a31a2}">
<IDSymbol name="ApplySampleData.bmpId"
value="1" />
</GuidSymbol>
</Symbols>
and apply it to a button
<Buttons>
<!-- snip -->
<Button guid="guidEditorExtensionCommandSet"
id="setDesignTimeDataOnPage"
priority="0x0100">
<Icon guid="ApplySampleData.bmpGuid"
id="ApplySampleData.bmpId" />
<Strings>
<!-- snip -->
</Strings>
</Button>
</Buttons>
Of course, its always easier to use the available tools, including the excellent VSPackage Builder extension.
A workaround for this is to create a PNG and rename the extension as *.bmp. VS will accept it as an icon image and it will also have transparency (from Visual Studio Extensibility > Toolbox Icons -- Is transparency supported?)
I have seen How do you create an event log source using WiX. My question is what is the common use (scenario) of specifying Event Source in Wix? I was thinking that specifying the source would list your application's install/uninstall process under that source in the event log so it would be easy to filter/check but even after doing that the source shows up as MsiInstaller for me. What am I doing wrong or am I misunderstanding the use of util:EventSource?
Here is my code :
<Component Id="EventLogSettings" Guid="A456420B-21E7-4306-904E-5CD3822193F0">
<util:EventSource Log="Application" Name="WixSample" SupportsErrors ="yes" SupportsInformationals ="yes" SupportsWarnings ="yes" EventMessageFile="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll" KeyPath="yes"/>
<!--<?if $(var.Platform) = x64 ?>
<util:EventSource Log="Application" Name="WixSample" EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR64]EventLogMessages.dll" KeyPath="yes" />
<?else ?>
<util:EventSource Log="Application" Name="WixSample" EventMessageFile="[NETFRAMEWORK20INSTALLROOTDIR]EventLogMessages.dll" KeyPath="yes" />
<?endif ?>-->
</Component>
As you can see I tried two options. Each of them creates a registry entry in the Computer\HKLM\SYSTEM\CurrentControlSet\services\eventlog\Application\WixSample but I am not sure if I need to reference the WixNetFxExtension. If I do then what about installation of non .net application? What do I do in those cases?
You are misunderstanding EventSource. EventSource is used to create a custom source for your application to use in it's logging to the windows event log.
You will always see the install/uninstall of your application show up as MsiInstaller.
We have an add in for VS that currently is launched from the tools menu, the add-in consists of a a UI offering the user a few option buttons, which I now want to convert to a top-level menu that would offer the same functionality.
I've read this tutorial, which helped me add a new top-level menu, but couldn't really understand the logic behind all the steps. The guide doesn't really clear what each of the steps create or how can your change the output.
What the steps create is a new top-level menu with a single item underneath it. I'm trying to create some hierarchy in my menu (i.e. Top Level -> Sub category -> Commands) but got abit lost with all the groups/menus/IDs structure.
Is there any clear explanation for the structure of these files? A documentation or a tutorial? If anyone had experience in the subject and could help clear things up I would much appreciate it...
I haven't tried doing hierarchical menu items, but I have had similar problems with the Visual SDK .vcst file. It is a pain. A couple of things you can do.
Install the VS Package Editor to Visual Studio Blog Entry for it: http://blogs.msdn.com/b/visualstudio/archive/2010/09/08/introducing-the-vspackage-builder.aspx
Download source code (open source so you can see how they do it) for an add-in that does similar things. Example is AnkhSVN which is a Subversion Repository Add-in to Visual Studio. Here is the source code: http://ankhsvn.open.collab.net/source/browse/ankhsvn/
I assume that nowadays by "add-in" you mean an extension that is a VS package (using the VS SDK) because an "add-in" was an older form of extension for VS 2013 and lower. (If you really mean an "add-in" then see my sample HOWTO: Adding buttons, commandbars and toolbars to Visual Studio .NET from an add-in)
Packages use .vsct files. To answer your question, see the .vsct files of my samples here:
CommandTopMenu
CommandSubMenu
(and to learn see also the other ones for context menus, toolbars, etc.). In the .vcst file they use "CommandPlacements" to separate the definition of an item from its "placement", and comments to explain the relationship between the 3 kinds of items:
Menus (Main-menu/Top-menus/Sub-menus/Context menus) and Toolbars.
Groups: a group is a container for other groups and also for commands and sub-menus.
Commands
Remember the rules:
The parent of a top-menu is always the Main menu of VS, never a group
The parent of a sub-menu is always a group, never directly a toolbar or any kind of menu.
The parent of a command is always a group, never directly a toolbar or any kind of menu (same rule that for sub-menus)
The parent of a group can be a menu, a toolbar, a context menu, etc. and it can be also another group.
A menu (any kind) or toolbar can be either created by your extension (except the main menu of VS) or an existing one of VS, identified by prefix "IDM_". See GUIDs and IDs of Visual Studio menus and GUIDs and IDs of Visual Studio toolbars.
A group can be either new (created by your extension) or an existing group of Visual Studio, identified by prefix "IDG_". You have some built-in Visual Studio groups in the links above, but for a more exhaustive list install the ExtensionTools extension (Mads Kristensen) that provides intellisense in the .vsct file or check the source code of its VsctBuiltInCache.cs file.
Code example
<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="...">
<!-- Extern section unchanged -->
<Commands package="guidHowToPackagePkg">
<Menus>
<!-- New menu added -->
<Menu guid="guidBasicVSCTSampleCmdSet" id="SubMenu" priority="0x200"
type="Menu">
<Parent guid="guidBasicVSCTSampleCmdSet" id="TopLevelMenuGroup" />
<Strings>
<ButtonText>Other Commands</ButtonText>
<CommandName>Other Commands</CommandName>
</Strings>
</Menu>
</Menus>
<Groups>
<!-- Group changed to SubMenuGroup and attached to SubMenu -->
<Group guid="guidBasicVSCTSampleCmdSet" id="SubMenuGroup"
priority="0x0600">
<Parent guid="guidBasicVSCTSampleCmdSet" id="SubMenu"/>
</Group>
</Groups>
<Buttons>
<!-- We attached these two buttons to SubMenuGroup -->
<Button guid="guidBasicVSCTSampleCmdSet" id="ThirdCommand" priority="0x0100"
type="Button">
<Parent guid="guidBasicVSCTSampleCmdSet" id="SubMenuGroup" />
<Icon guid="guidImages" id="bmpPicX" />
<Strings>
<CommandName>ThirdCommand</CommandName>
<ButtonText>Third Command</ButtonText>
</Strings>
</Button>
<Button guid="guidBasicVSCTSampleCmdSet" id="FourthCommand"
priority="0x0101" type="Button">
<Parent guid="guidBasicVSCTSampleCmdSet" id="SubMenuGroup" />
<Icon guid="guidImages" id="bmpPicArrows" />
<Strings>
<CommandName>FourthCommand</CommandName>
<ButtonText>Fourth Command</ButtonText>
</Strings>
</Button>
</Buttons>
</Commands>
<Symbols>
<!-- We add a SubMenu and changed SubMenuGroup -->
<GuidSymbol name="guidBasicVSCTSampleCmdSet" value="...">
<IDSymbol name="SubMenu" value="0x0101" />
<IDSymbol name="SubMenuGroup" value="0x0201" />
</GuidSymbol>
</Symbols>
</CommandTable>
This provides you with the following top-level menu:
Here's a full chapter on the topic. This pretty much explains everything there is to know on (hierarchical) menu's.
http://dotneteers.net/blogs/divedeeper/archive/2010/05/23/vs-2010-package-development-chapter-2-commands-menus-and-toolbars.aspx