-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom attribute to Bundle project (Bootstrapper) #137
Comments
You cannot use Thus, as in any other case of XML ambiguity, you will need to handle the problem an XML way: bootstrapper.IncludeWixExtension("WixDependencyExtension.dll", "dep", "http://schemas.microsoft.com/wix/DependencyExtension");
...
bootstrapper.WixSourceGenerated += (doc) =>
{
var dep = doc.Root.GetNamespaceOfPrefix("dep");
doc.Root.Select("Bundle").Add(new XAttribute(dep + "ProviderKey", "01234567-8901-2345-6789-012345678901"));
}; It's possible to extend the current "add attribute" algorithm to support XML namespeces by introducing an alternative delimiter to indicate the namespace as opposite to the parent element. Though the best candidate "column" is already taken :( The ideal solution would be: project.AttributesDefinition="Component|SharedDllRefCount=yes";
// and
project.AttributesDefinition="dep:ProviderKey=01234567-8901-2345-6789-012345678901"; And because ':' is taken (and already in use for quite some time) a less intuitive second delimiter will need to be introduced. Something like this: project.AttributesDefinition="Component:SharedDllRefCount=yes";
// and
project.AttributesDefinition="dep'ProviderKey=01234567-8901-2345-6789-012345678901";
// or
project.AttributesDefinition="{dep}ProviderKey=01234567-8901-2345-6789-012345678901"; This is what I haven't decided yet and would appreciate the community feedback. Anyway I am marking this issue as a feature requests so the namespace support comes in one or another way. |
@oleg-shilo, thank you very much. This is working for me. But looks like this doesn't resolve mine problem. Maybe you can help me with it ? When I've install my application from bootstrapper installer, I have 2 new installed programms: mine program with ID which is not same as I set for .msi package; and another for bootstrapper installer. Uninstall shortcut has Target attribute for program (not for bootstrapper installer). Maybe I can get ID value for bootstrapper installer from WPF code ? (for change Uninstall shortcut to shortcut for bootstrapper installer) For example: |
I am not sure if you can extract the GUID from the bootstrapper app. Though you definitely can from MSI. Also keep in mind that you have full control over MSI identities (see this doc section). Meaning that you can specify your Product and Upgrade code (that appears in Control Panel) directly in your project definition. |
@oleg-shilo, ok thank you. I did not think about a more optimal option than parse registry branch for Uninstall programs and search installed bootstrapper application. After that, change the Target property in the Uninstall.lnk file to UninstallString from the registry. |
BTW, that bootstrapper GUID that you see in Control Panel is most likely the "bootstrapper.UpgradeCode" that you assigned in the project definition. |
@oleg-shilo, looks like no. |
I expect you to see no In case of any uncertainty have a look at your MSI in Orca (MSI viewer). It will let you see directly in the MSI tables. |
@oleg-shilo. ok thank you Oleg. I will look. Maybe I'll find something I need :) |
- Added support for XML namespace prefix in 'AttributesDefinition` `AttributesDefinition = "{dep}ProviderKey = 01234567-8901-2345-6789-012345678901"`
Hi, I am trying to add custom attribute to MsiPackage element in Bundle using the wix extensions. After adding the custom attribute to my .xsd file and making necessary changes to CompilerExtension.cs and PreprocessorExtension.cs, still candle.exe is throwing an error saying that "The MsiPackage element contains an unexpected attribute error:Custom attribute" Any idea to resolve this error ? Thanks for your help |
* Issue #137: Add custom attribute to Bundle project (Bootstrapper) * Issue #452: Component Id generation for RegValue does not take RegValue.Id into account * An empty directory remains after the uninstall #464 * `AutoElements.SupportEmptyDirectories` default setting to `Automatic` is made obsolete, though is not removed yet. In the future releases `AutoElements.SupportEmptyDirectories` will be enabled by default. * `File.OverwriteOnInstall` now triggers insertion of `<RemoveFile On=both ...>` instead of `<RemoveFile On=install ...>`. To avoid upgrade problems with individual files. * Fixed the problem with `project.ActualInstallDirId` being potentially undefined * ResilientPackage improvements - Create a hard link to the local package instead of the original MSI. - Added deterministic assignment of installdir id in `EnableResilientPackage` * Bootstrapper_UI sample is updated to show how to pass user input from BA to MSI package.
First of all, a few words about the original problem reported in this thread. Unfortunately the feature (support for custom attributes) has been implemented but only partially. Thus The very latest release v1.9.2 addresses the issue and now you can add custom attributes to the bootstrapper.IncludeWixExtension(@"WixDependencyExtension.dll", "dep", "http://schemas.microsoft.com/wix/DependencyExtension");
bootstrapper.AttributesDefinition = "{dep}ProviderKey=01234567-8901-2345-6789-012345678901"; This feature is yet to be extended to Packages but non custom attributes are already supported by all entities across the system. If you find that you cannot add custom attribute with WixSharp default functionality you can always inject then via xml-injection mechanism (see InjectXML sample). Now, about your problem. I am not sure I follow. What are those Anyway, if you add attribute from the custom namespace you typically need to add this namespace via "WixExtension". This is what that |
Hello, I am sorry to confuse you. I have created my own extension schema and added custom elements to Bundle element like
But I would also like to add custom attribute to existing MsiPackage element in Bundle like
I have added to custom attribute to my xsd file using As per wix documentation on MsiPackage element Any Attribute (namespace='##other' processContents='lax') Extensibility point in the WiX XML Schema. Schema extensions can register additional attributes at this point in the schema. The extension's CompilerExtension.ParseAttribute() method will be called with the package identifier in contextValues["PackageId"]. Unfortunately I am getting error saying that MsiPackage contains unexpected element mySchema:CustomAttr1. The wix schema is not recognizing my custom attribute (CustomAttr1). Please provide your suggestions on this ? Thanks in Advance |
If compiler says that it cannot recognize your namespace extension and the name of the namespace is correct (I assume For example the assembly that defines bootstrapper.IncludeWixExtension(@"WixDependencyExtension.dll", "dep", "http://schemas.microsoft.com/wix/DependencyExtension"); Something similar needs to be done for your assembly as well. |
I'am trying to add custom attribute
dep:ProviderKey = 01234567-8901-2345-6789-012345678901
to Bundle tag of bootstrapper .wxs file (I hope this help me hardcode GUID value for bootstrapper installer):I'am tried use and Attributes property and AttributesDefinition property and has the same result:
The Bundle element contains an unexpected attribute 'WixSharpCustomAttributes'.
What I do wrong ? How I can add custom attribute to Bundle project ?
The text was updated successfully, but these errors were encountered: