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

New Post: Changing icon in top left corner of forms

$
0
0
You can do this by accessing the shell form when UI is loaded. Changing the icon is a typical WinForm task and a simple way to accomplish it is to embed your icon in the assembly resources and extract it at runtime. You can also embed it into msi if you wish:
var project = new ManagedProject("ManagedSetup",
                    new Binary(new Id("appIcon"), "<path to your icon>"),
                    ...
project.UILoaded += UILoaded;    
...
staticvoid UILoaded(SetupEventArgs e)
{
    var data = e.Session.GetEmbeddedData("appIcon");
    using (var stream = new System.IO.MemoryStream(data))
        (e.ManagedUIShell as Form).Icon = new Icon(stream);
}

New Post: Changing icon in top left corner of forms

New Post: Sample for "Modifying app config file as a post-install action"

$
0
0
Hi,

I have tried this modification method but custom action OnInstall is not getting executed. Hence the file is copied as it is. Could u please help?
Thanks

New Post: FeaturesDialog does not work

$
0
0
Thank you for your replay!

The code
project.MinimalCustomDrawing = true;
have fixed the situation.... Now the msi works without exception.
so strange behavior....

Below is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using System.Xml.XPath;

using WixSharp;
using WixSharp.CommonTasks;
using WixSharp.Forms;
using WixSharp.UI.Forms;


// https://wixsharp.codeplex.com/releases/view/624868
// https://wixsharp.codeplex.com/SourceControl/latest#readme.txt

namespace MsiAppFormTest
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      InitializeComponent();
    }

    private void btDeploy_Click(object sender, EventArgs e)
    {
      Compiler.WixLocation = @"some_location2\_msi\WixSharp.1.0.40.0\Wix_bin\bin\";

      var general = new Feature("General files", true, false);
      var modules = new Feature("Modules files", true, true);
      var modulett0 = new Feature("t0Module", true, true);
      var modulet1 = new Feature("t1Module", true, true);
      var modulet2 = new Feature("t2Module", true, true);
      var modulet2 = new Feature("t3Module", true, true);
      var modulet4 = new Feature("t4Module", true, true);
      var modulet5 = new Feature("t5Module", false, true);
      var modulet6 = new Feature("t6Module", false, true);
      var modulet7 = new Feature("t7odule", false, true);

      modules.Add(modulet0);
      modules.Add(modulet1);
      modules.Add(modulet2);
      modules.Add(modulet3);
      modules.Add(modulet4);
      modules.Add(modulet5);
      modules.Add(modulet6);
      modules.Add(modulet7);

      general.Add(modules);

      ManagedProject project = new ManagedProject("agent",
                        new Property("RURL", @"https://url.com") { IsDeferred = true },

                        new Dir(@"%ProgramFiles%\agent",
                          new File(modulet0, @"some_location\t0.dll"),
                          new File(modulet1, @"some_location\t1.dll"),
                          new File(modulet2, @"some_location\t2.dll"),
                          new File(modulet3, @"some_location\t3.dll"),
                          new File(modulet4, @"some_location\t4.dll"),
                          #region MySql
                          new File(modulet5, @"some_location\t51.dll"),
                          new File(modulet5g, @"some_location\t52.dll"),
                          #endregion
                          #region oracle
                          new File(modulet6, @"some_location\t6.dll"),
                          new Dir(modulet6, @"OraClient.x64",
                            new File(modulet6, @"some_location\OraClient.x64\oci.dll"),
                            new File(modulet6, @"some_location\OraClient.x64\ociw32.dll"),
                            new File(modulet6, @"some_location\OraClient.x64\orannzsbb10.dll"),
                            new File(modulet6, @"some_location\OraClient.x64\oraocci10.dll"),
                            new File(modulet6, @"some_location\OraClient.x64\oraociei10.dll")),
                          new Dir(modulet6, @"OraClient.x86",
                            new File(modulet6, @"some_location\OraClient.x86\oci.dll"),
                            new File(modulet6, @"some_location\OraClient.x86\ociw32.dll"),
                            new File(modulet6, @"some_location\OraClient.x86\orannzsbb10.dll"),
                            new File(modulet6, @"some_location\OraClient.x86\oraocci10.dll"),
                            new File(modulet6, @"some_location\OraClient.x86\oraociei10.dll")),
                          #endregion
                          #region ftp
                          new File(modulet7, @"some_location\t7.dll"),
                          new File(modulet7, @"some_location\t71.dll"),
                          new File(modulet7, @"some_location\t72.dll"),
                          #endregion

                          new Dir(general, @"x64", new File(@"some_location\x64\SQLite.Interop.dll")),
                          new Dir(general, @"x86", new File(@"some_location\x86\SQLite.Interop.dll")),

                          new File(general, @"some_location\a0.db"),
                          new File(general, @"some_location\a1.pos"),
                          new File(general, @"some_location\a2.json"),
                          new File(general, @"some_location\agent.config"),

                          new File(general, @"some_location\System.Data.SQLite.dll"),
                          new File(general, @"some_location\a5.dll"),
                          new File(general, @"some_location\agent.exe"),

                          new File(general, @"some_location\u0.config"),
                          new File(general, @"some_location\u1.exe"))
                        );

      project.DefaultFeature = general;
      project.DefaultFeature.Children.Add(modulet0);
      project.DefaultFeature.Children.Add(modulet1);
      project.DefaultFeature.Children.Add(modulet2);
      project.DefaultFeature.Children.Add(modulet3);
      project.DefaultFeature.Children.Add(modulet4);
      project.DefaultFeature.Children.Add(modulet5);
      project.DefaultFeature.Children.Add(modulet6);
      project.DefaultFeature.Children.Add(modulet7);

      //if( Environment.GetEnvironmentVariable("buid_as_64") != null ) project.Platform = Platform.x64; // работает НЕвсегда....
      if( IntPtr.Size == 8 ) project.Platform = Platform.x64;

      project.GUID = new Guid("0c47a0be-437d-4ab6-883a-f0ecc38ddbff");
      project.PreserveTempFiles = true;
      //project.MinimalCustomDrawing = true; // <-------------------------- fix the problem

      project.ManagedUI = new ManagedUI();
      project.ManagedUI.InstallDialogs.Add<WelcomeDialog>()
                                      .Add<LicenceDialog>()
                                      .Add<InstallDirDialog>()
                                      .Add<FeaturesDialog>()
                                      .Add<CustFormSrvAdr>()
                                      .Add<ProgressDialog>()
                                      .Add<ExitDialog>();

      project.ManagedUI.ModifyDialogs.Add<FeaturesDialog>()
                                     .Add<ProgressDialog>()
                                     .Add<ExitDialog>();

      project.AfterInstall += Project_AfterInstall;
      Compiler.BuildMsi(project);

      MessageBox.Show("Completed successfully!", "Status");
      Close();
    }

    private static void Project_AfterInstall(SetupEventArgs e)
    {
      if( e.IsInstalling ) {
        string strSrvUrl = e.Session.Property("URL");
        string configFile = System.IO.Path.Combine(e.InstallDir, "Agent.config");

        UpdateAsXml(configFile, strSrvUrl);
      }
      else if( e.IsUninstalling ) {
        try {
          System.IO.Directory.Delete(e.InstallDir, true);
        }
        catch { /*log error if required*/ }
      }
    }

    static public void UpdateAsXml(string configFile, string strSrvUrl)
    {
      var xDoc = XDocument.Load(configFile);
      xDoc.XPathSelectElement("//configuration/appSettings/add[@key='bla-bla']").Attribute("value").Value = strSrvUrl;
      xDoc.Save(configFile);
    }
  }
}

New Post: FeaturesDialog and MinimalCustomDrawing = false;

$
0
0
Hi,

do we have the chance of using the FeaturesDialog with the MinimalCustomDrawing = false?
In current release it generate the exception in final msi.

New Post: FeaturesDialog does not work

$
0
0
I tested your code. And it seems to have no problems rendering the TreeView on my system (Win10 x64). It's kinda expected as everything indicated it was a pure rendering problem, which doesn't depend on the MSI content but on the target system rendering capabilities.

Image

Have you tested my sample?

It means that as I suspected your target system and Wix# tree node rendering algorithm are incompatible in some way. What way? It's hard to say as I have no test case to work with.

However that setting MinimalCustomDrawing is implemented exactly for the cases like yours. It doesn't do much, it simply excludes custom drawing of the node and falls back to the default system drawing algorithm. Custom drawing was needed only to improve the the appearance of the feature text in the TreeView . If you have it disabled with MinimalCustomDrawing = true the disabled feature text color will still be black instead of gray (limitation of TreeView WinForms control). Not a big lost particularly in your case as your target system where new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Opened); cannot be executed without the exception. Why? Who knows. It's deep in WinForms implementation. Fixing it impossible because it's not in Wix# code. Work around is possible but not feasible without the test case and as far as I know it's not reproducible on other systems except yours.

Thus you can safely disable advanced custom drawing with 'project.MinimalCustomDrawing = true;'. I did not defaulted it to true because I thought that the chances of incompatibility are very low. And it is the case as it is the first report for the last 2-3 years the feature exists. But if I have at least another report like yours I will change the defaults.

New Post: post-install action in ManagedProject

$
0
0
Hi, Oleg!
Now I use v1.0.40.2-HotFix.
In custom dialog I set:
MsiRuntime.Data["DATABASE_CONNECTION_STRING"] = @"Data Source=.\SQLEXPRESS;Initial Catalog=RequestManagement;Integrated Security=SSPI".
e.Data["DATABASE_CONNECTION_STRING"] in AfterInstall handler returns "Data Source".

New Post: post-install action in ManagedProject

$
0
0
OK I see.
MsiRuntime.Data at runtime is serialized into semicolon delimited key-value pares and because MSSQL is using the same encoding technique for connection strings it interferes with the Wix# MsiRuntime.Data serialization.

It is a Wix# problem and it will need to take about escaping ; and = in user input values. Currently it does it for line breaks only. As a very temporary work around you can use your own escaping. Something like this:
var conn = @"Data Source=.\SQLEXPRESS;Initial Catalog=RequestManagement;Integrated Security=SSPI";
MsiRuntime.Data["DATABASE_CONNECTION_STRING"] = conn.Replace(";", "&#59;")Replace("=", "&#61;");
...
var conn = MsiRuntime.Data["DATABASE_CONNECTION_STRING"];
conn =  = conn.Replace("&#59;", ";").Replace("&#61;", "=");
Thank you. I'll keep you informed on the fix availability. It will happen very soon. Most likely today.

P.S. I also created the issue on your behalf: https://wixsharp.codeplex.com/workitem/130

New Post: FeaturesDialog does not work

$
0
0
I checked the source code and the impact of MinimalCustomDrawing = true is even less than I anticipated. It is in fact a check box who gets grayed out if the node is a read-only one, not the text. Thus the visual compromize is very minor.

I also saw the opportunity there to fall back to default TreeView checkbox node rendering automatically as the result of the handled runtime exception. This way you don't have to set MinimalCustomDrawing = true at compile time. This change will be available with the very next release (very soon).

New Post: post-install action in ManagedProject

$
0
0
Can you please test the latest NuGet release v1.0.40.3
Install-Package WixSharp.bin -Pre
It should do the escaping/unescaping automatically

New Post: FeaturesDialog does not work

$
0
0
The latest NuGet prerelease v1.0.40.3
Install-Package WixSharp.bin -Pre
does the trick with automatic fallback to the minimized custom drawing in case of any runtime error in the drawing routine.

Note that if you don't set the value of MinimalCustomDrawing Wix# will try to determine its value at runtime. This is the whole algorithm expressed in a pseudo-code:
if MinimalCustomDrawing.IsSet:
    if MinimalCustomDrawing == true:
        CustomDrawModel = TextOnly 
    else:
        CustomDrawModel = DrawAll
else:
    if current_DPI == 96:
        CustomDrawModel = DrawAll 
    else:
        CustomDrawModel = TextOnly 
...
void DrawAll_Routine()
{
    try:
        // do the drawingcatch:
        CustomDrawModel = TextOnly
}
I checked the source code and the impact of MinimalCustomDrawing = true is even less than I anticipated. It is in fact a check box who gets grayed out if the node is a read-only one, not the text. Thus the visual compromize is very minor.

I also saw the opportunity there to fall back to default TreeView checkbox node rendering automatically as the result of the handled runtime exception. This way you don't have to set MinimalCustomDrawing = true at compile time. This change will be available with the very next release (very soon).

New Post: FeaturesDialog does not work

$
0
0
Oleg,
I am trying new (1.0.40.3) version. The result:
Image

With previous (1.0.40.2) version the project works.

New Post: FeaturesDialog does not work

$
0
0
Yeah, I sent you the message about that yesterday but it somehow didn't go through.

You see, when working on your problem report I discovered that there is a logical flaw in the feature hierarchy building algorithm that Wix# using. I logged the defect for this (https://wixsharp.codeplex.com/workitem/131) and it got fixed in the v1.0.40.3.

However the defect (before the fix) was hiding the problem with your code. The defect is fixed now and as expected your code can no longer compile.
The problem in your code is that you are adding modulet0 to both DefaultFeature and modules and this is wrong. According MSI feature model a single feature can only be present in a single point of the feature tree. Thus if you want to fix your code you will need to remove the following code block:
project.DefaultFeature.Children.Add(modulet0);
...
project.DefaultFeature.Children.Add(modulet1);

New Post: FeaturesDialog does not work

$
0
0
Oleg, thank you for your FAST reply!

I have removed the following part of code:
project.DefaultFeature.Children.Add(modulet0);
...
project.DefaultFeature.Children.Add(modulet1);
The project works but no msi is generated....
In other words the project does not generate an error but does not create the result msi file....

New Post: FeaturesDialog does not work

$
0
0
It's hard for me to comment as I have very little information about how you conduct your testing.

I know for sure that the code you shared with me is not exactly the same the code you test. I conclude this from the fact that there were a few C# syntax errors that Visual Studio could not possibly pass through and yet you have reached somehow MSI testing stage.

I don't know how you build your msi. Is it VS Wix# project? Is it VS C# project? Where do you look for errors?

Why don't we change the approach to be more productive. Let's try to build/run/test something that already works.
I have already shared with you a complete VS project for the first problem described in this thread. Did you run it? I had no feed back from you on this. Though arguably it doesn't matter any more.

Please download the complete test case from here: https://dl.dropboxusercontent.com/u/2192462/Support/dx2003/FeatureTree.7z and tell me if you can build it.

It is not a VS project but a build script that you can run if you have Wix# installed (download page on this site). In order to build it you will need to ensure the correct locations in the build.cmd and setup.cs.

Though if you have difficulties running the build script with batch file then you will have to prepare a proper test case - VS project that I can load and test in my environment.

New Post: FeaturesDialog does not work

$
0
0
Oleg,
your test case works well!
sorry, I have found the error in my project.... and have fixed it.
now it works fine also.
no problem with your new (10.0.40.3) build
thank you!

New Post: FeaturesDialog does not work

$
0
0
Great. Thank you. Now I will be making a proper release.

New Post: post-install action in ManagedProject

New Post: FeaturesDialog does not work

$
0
0
All done. Fixed in Release v1.0.41.0

New Post: FeaturesDialog and "Back" action

$
0
0
Hi Oleg,
I am afraid the back action does not work correctly.
1) The Back button is always disabled
2) After return back to FeaturesDialog the feature tree recreated incorrectly

Image
Viewing all 1354 articles
Browse latest View live


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