Quantcast
Channel: wixsharp Discussions Rss Feed
Viewing all 1354 articles
Browse latest View live

New Post: how get msi code error.

$
0
0
Not sure I understand the question.

If you are asking about MSI session property and you are still talking about GenericSetup (WixSharp.Msi.dll ) then it is via Session object. It will have either indexer or something similar.

Though the C# code fragment for accessing registry that you provided indicates that you may be talking about something else.

New Post: Can't run code once upgrading from 1.0.7.0 to 1.0.41.0

$
0
0
Could you please provide a simple test project that demonstrates the problem.
Thank you

New Post: Can't run code once upgrading from 1.0.7.0 to 1.0.41.0

$
0
0
I will try, though the project is big so I can take some time.

In the meantime, let's see if you can help me with what I wrote above.

Why CDATA has been removed from conditions by default? The conditions can have values that may interfere with XML, and therefore not being properly parsed while using methods for XDocument.

It looks like for example, that document.Root.Select("Product") returns a value, but can't reach: document.Root.Select("Product").Element("InstallExecuteSequence")
in the patch method.

1) Do you have anyway to workaround this?
2) What toCdata method is used for? Any real example?

Michael

New Post: how get msi code error.

$
0
0
in setup.cs file i use condition => new LaunchCondition(@"(Installed OR FLASH_CURRENT_VERSION)", "Flash Player is not installed.Please install Flash Player.")
and project property => new RegValueProperty("FLASH_CURRENT_VERSION", RegistryHive.LocalMachine, @"SOFTWARE\Wow6432Node\Macromedia\FlashPlayerActiveX", "Version")
This work when i run setup.msi. If the key is "SOFTWARE\Wow6432Node\Macromedia\FlashPlayerActiveX\Version" does not exist, I get message "Flash Player is not installed.Please install Flash Player."
but when I run MySetup.exe (custom UI with GenericSetup) it return error 1603. Рow to find value FLASH CURRENT_VERSION in MySetup?

New Post: Can't run code once upgrading from 1.0.7.0 to 1.0.41.0

$
0
0
Don't worry about the project I see now the problem you are trying to solve. It looks like you are trying to set an action condition. This is what wasn't clear for me.

> Why CDATA has been removed from conditions by default?
I am not sure Wix# ever used CData by default for all WiX types/elements. (Though may be I just don't remember).
Anyway, currently Wix# checks if the Condition value has any XML delimiter and encodes it as a CData if any detected. However it looks like in your case the detection algorithm failed and Wix# missed that fact that your Condition interferes with XML encoding. That is why I really need to know what was your condition value that did not trigger the CData encoding.

> ...It looks like for example, that document.Root.Select("Product") returns a value, but can't reach:...
Correct. You are using XDocument Element to access it and most likely it can be only accessed with use of proper XML namespaces. Anyway, I always encourage users to use Wix# XML extensions for accessing the elements transparently by the "local names". The syntax that you were looking for is as follows:
staticvoid Project_WixSourceGenerated(XDocument document)
{
    var element = document.Root.Select("Product/InstallExecuteSequence")
                                .FindAll("Custom")
                                .First(x => x.Value == "MY_CONDITION");

    element.ReplaceNodes(new Condition("<your condition>").ToCData());
}
However in your case you don't have to do XML injection as you can force CData encoding in a more direct way:
AutoElements.ForceCDataForConditions = true;
As for the auto detection of CData triggering conditions I will proceed with the fix when I have a sample of the "offending" Condition value.

New Post: how get msi code error.

$
0
0
MSI is a complicated system. I fact overcomplicated.

The fact that it runs as "mesiexec.exe+setup.msi" but not as "setup.exe+setup.msi" indicates that there is nothing wrong with the actual msi. And the change in the msi behavior at runtime can only be explained by the differences in the used msi hosting model. For example in case of EmbeddeUI scenario MSI runtime completely ignores InstallUISequence and any actions scheduled for this sequence will not be executed. This is the nature of the MSI architecture. You may also experience problems with custom/standard actions that require elevation if your host (setup.exe) is not elevated.

Thus for all practical reasons you probably better off by just doing your LaunchCondition evaluation directly in your host application (setup.exe) at startup. After all it's just reading a single registry value with C#.

New Post: Can't run code once upgrading from 1.0.7.0 to 1.0.41.0

$
0
0
It looks like the second point was the problem and the parsing of CDATA is ok so far.

New Post: Automatic appending suffixes and changing GUID for various entities while running for several languagues

$
0
0
I am trying to run my build MSI on several languages, but it looks like the newer version (1.0.41.0) has changed the way the various entities have been created.

For example while running on a second language I get the following:
<Component Id="Component.App.1" Guid="ff11fdfe-8c4e-4c21-be49-1ef853673915">
              <File Id="App.dll.1" Source="..\..\ProgramFiles\App.dll" Compressed="yes" />
 </Component>
while in the initial language
<Component Id="Component.App.dll" Guid="ff11fdfe-8c4e-4c21-be49-1ef85bc1e493">
              <File Id="App.dll" Source="..\..\ProgramFiles\App.dll" Compressed="yes" />
  </Component>
As you can see .1 was appended and the GUID was changed.
In the previous version of Wix#, it was the same on all languages run.

Here is the sample code:
   static public void Main(string[] args)
   {
    [...]           
            foreach (var lang in Configuration.LanguageTable)
            {
                BuildMsi(version, lang);
            }
    }

 private static void BuildMsi(Version version,string language)
        {
            Feature applicationFeature = new Feature("Application");
          
            Project project = new Project
            {
               [....]
     
                Package = new Package
                {
                       [....]      
                },

                Dirs = new[]
                {
                    new Dir(ConfigurationManager.AppSettings["InstallDir"] 
                    new DirFiles(applicationFeature,ConfigurationManager.AppSettings["ProgramFilesSrcDir"] + @"\*")
                }

               [....]
               project.ResolveWildCards();

               [....]
}
Any idea how to block this?

New Post: Automatic appending suffixes and changing GUID for various entities while running for several languagues

$
0
0
> ... running on a second language...
Sorry I cannot understand what it means. But something tells me that it might be irrelevant.

Wix# is a WiX based MSI authoring solution. But not WXS building tool. Thus wxs is considered to be an intermediate building step only. Thus the specific elements and layout (e.g. elements order) are irrelevant as long as the output msi file produced correctly. That is why Wix# is completely removing from user view bunch of XML definitions that can be auto generated insted manually defined by user. Component element is handled this way. The component Id and Guid auto-generation algorithm is based on component content (e.g. File element id/name). This algorithm can change from time to time to address certain id allocation issues. For example there were reports about potential duplication of component Id so the algorithm had to be changed to ensure uniqueness of the allocated Ids. But this in no way affected building the final msi so there should be no problems for users.

Thus my question is: "What is exactly the problem that you are trying to solve?" It seems like you have no problems with building msi. Is it correct?

Anyway, if for whatever reason you want to overwrite the component id allocation you can do it by providing an explicit ID/GUID via WixEntity attributes as demonstrated below:
new Dir(@"%ProgramFiles%\My Company\My Product",
                    new File("setup.cs") { AttributesDefinition = "Component:Id=MyComId;Component:Guid=ffffffff-ffff-4544-b2b6-960518a0ecba" }),
It will produce this WXS:
<ComponentId="MyComId"Guid="ffffffff-ffff-4544-b2b6-960518a0ecba"><FileId="setup.cs"Source="setup.cs"/></Component>
It will work but to be honest it will defete the whole purpose of Wix#.

New Post: Disable or Suspend ICE at the Build

$
0
0
Hey,

I have the Problem that VS get an exception with my RegValue(RegistryHive.CurrentUser, "Control Panel\Desktop", to an "System32-Path")

the following Exceptions get I

at first " error LGHT0204: ICE57: Component 'Registry1' has both per-user and per-machine data with a per-machine KeyPath"

then the .MSI get Build and after the Information over the MSI I get another error
"error MSB3073: Der Befehl ""My Repository Path to Release\WixSharp Setup.exe" "/MSBUILD:Installer"" wurde mit dem Code -1 beendet."


But the MSI which I get makes that what it should do.

So how get I the exception away?

New Post: Disable or Suspend ICE at the Build

$
0
0
Yes ICE validation sometimes leads to the wired, hard to interpret and difficult to deal with results. And what even more annoying that ICE errors/warnings are not even errors and shouldn't be even raised in the first place.

I suggest that you have a look at the emitted WXS file and verify that the misbehaving XML code is indeed what you need. And after that you can disable the ICE specific test(s) with light.exe command line switches.

The switch can be specified via Compiler or Project LightOptions field, which by default already passes some arguments for warnings disabling:
staticpublicstring LightOptions = "-sw1076 -sw1079";
Note that Wix# already tries resolve some absurd ICE constrains by auto-injecting ICE required elements, which are strictly speaking unnecessary for your deployment. But it looks like in your case it isn't enough. Though may be this auto-injection in fact conflicts with your setup definition... Anyway you can also experiment by disabling auto injection via AutoElements.DisableAutoKeyPath.

New Post: WixSharp executing project.

$
0
0
Hi,

I notice when I am doing simple project like the following, that wixsharp seems to build the MSI when I build my app in visual studio. Is there a way I can turn this off so it only runs when I actually execute the code in visual studio. (Press the Start button).

Thanks,

Ward.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

 using WixSharp;

namespace Wix6
{
    class Program
    {
        static void Main(string[] args)
        {

            string compiler = @"D:\Data\Ward\Downloads\Compressed\WixSharp.1.0.41.0\Wix_bin\bin";

            Compiler.WixLocation = compiler;

            var project = new Project("MSI1");

            project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");

            Compiler.BuildMsi(project);

        }
    }
}

New Post: WixSharp executing project.

$
0
0
Yes it is possible. Just create a ConsoleApp prject and add "WixSharp.bin" NuGet package. That's it.

"WixSharp" package includes "WixSharp.bin" and a custom MSBuild target that triggers building MSI as post C# build step. And it is exactly the step that you don't need.

New Post: WixSharp executing project.

$
0
0
Hi Oleg,

Great thanks for your help.

Much appreciated.

Ward

New Post: Sending data from main function to custom dialog

$
0
0
Hi, Oleg!
I have ManagedProject.
I want to send string data from main function where I create ManagedProject and build MSI to load event handler of custom dialog.
How can I do it?

New Post: Upgrading program

$
0
0
I use ManagedProgect. How can I do in the UIInitialized event handler:
  1. Detect if my product is installed.
    I use AppSearch.IsProductInstalled(projectGUID), but it returns false if the program is installed.
    How to detect if my product is installed?
  2. If the product is installed, how to find out the version of product and installation folder?
  3. I want to save data from custom dialog in order to use it in the next installation. Where can I save the data?

New Post: Sending data from main function to custom dialog

$
0
0
You cannot do this.

The "main function where you create ManagedProject" is executed during the build msi procedure and your custom dialog is hosted by this MSI during install. Any data that you want to pass to the dialog needs to be obtained at run-time (not compile-time) in the dialog itself.

If the data your dialog needs need to be generated at compile time then you need to push it into the MSI property during the build and read from this property when your dialog is instantiated at run time.

New Post: Upgrading program

$
0
0
1 Detect if my product is installed
IsProductInstalled doesn't do much. It simply decorates and invokes system API IsProductInstalled. Thus if it doesn't return what you expect then most likely your projectGUID is not correct. You can have a look at GenericTest.AppSearchTest of WixSharp.Test projhect where IsProductInstalled is used to check if product "Windows Live Photo Common" is installed.
[DllImport("msi", CharSet = CharSet.Unicode)]
staticextern Int32 MsiGetProductInfo(string product, string property, [Out] StringBuilder valueBuf, ref Int32 len);

staticpublicbool IsProductInstalled(string productCode)
{
    var productNameLen = 512;
    var productName = new StringBuilder(productNameLen);
    if (0 == MsiGetProductInfo(productCode, "ProductName", productName, ref productNameLen))
        return !string.IsNullOrEmpty(productName.ToString());
    elsereturnfalse;
}
2 Assming you fixed your problem with productCode you can invoke MsiGetProductInfo with "Version" and it will return you a string of the DWORD value for
version. You can slice it to extract the version components.

The latest code of WixSharp.AppSearch (use git if you need to see it) already has an API for this:
staticpublic Version GetProductVersion(string productCode)
{
    var versionStr = GetProductInfo(productCode, "Version");

    //MMmmBBBBif (versionStr.IsNotEmpty())
    {
        int value;
        if (int.TryParse(versionStr, out value))
        {
            var major = (int)(value & 0xFF000000) >> 8 * 3;
            var minor = (int)(value & 0x00FF0000) >> 8 * 2;
            var build = (int)(value & 0x0000FFFF);
            returnnew Version(major, minor, build);
        }
    }

    returnnull;
}
3 Where can I save the data?
Anywhere you want. It's C# you can do anything you want. I guess some well-known locations (file system, registry...) can be an obvious choice.

New Post: Sending data from main function to custom dialog

$
0
0
I don't understand where I can push data into MSI property. In main function?

New Post: Upgrading program

$
0
0
When I use in 32-bit program WixSharp.AppSearch.GetProducts and WixSharp.AppSearch.GetProductCode, these functions drops.
In 64-bit version they work right.

When I try to detect if my product is installed I use project.GUID, but it isn't the same as returns AppSearch.GetProductCode(projectName). It differs from project.GUID in last 6 symbols. It's the same as project.ID. How can I get project.ID from project.GUID?
Or how transfer project.ID from main function where MSI is building to UIInitialized event handler?
Viewing all 1354 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>