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

New Post: IIS Virtual App inner folders duplication

$
0
0
Hi,

My MSI installs 2 websites and 1 win service (i.e 3 directories) and everything is installing to c:\programfiles(x86)\CompanyName\ProductName
I am successfully able to add given two websites in IIS as separate webapplications.

now how to install ProductName as a website and convert 2 of the directories inside to web-application (similar to manually doing it in IIS)

New Post: Force update for unversioned files

$
0
0
Hello,
What's the best way to force the update of unversioned files?
I have a set of XML files that have to be updated with any product upgrade, even if the user modified some of them after the previous installation/upgrade. The MSI file versioning rules (https://msdn.microsoft.com/en-us/library/aa368599(v=vs.85).aspx) prevent the update of the modified files in such cases. As far as I understand, using 'Companion Files' (i.e. linking those unversioned XML files to the versions of the exes/dlls) would be the way to go, but I can't find the support for that feature in Wix#.
Any advice please?
Thanks.

New Post: Force update for unversioned files

$
0
0
As with many other non primary attributes CompanionFile can be set via AttributeDefinition:
new File(@"Files\Docs\Manual.txt")
{
    AttributesDefinition = "CompanionFile=<whatever_value_you_need>"
}),
Though as for me, I wouldn't go this way. To be honest I even found the whole concept of something being installed, then overwritten by user, then replaced by the upgrade is questionable. It seems like a better separation between default and user specific settings is what your solution is lacking. MSI is a deployment solution so it only should be concerned about the delivery of the files but not about making any decisions regarding their content fate.

Anyway, if I really need to implement your requirement I would rather use something more manageable than MSI/WiX:
var project = 
    new Project("MyProduct",
        new Dir(@"%ProgramFiles%\My Company\My Product",
            new File(@"Files\Bin\MyApp.exe"),
            new File(@"Files\Bin\MyApp.exe.config.default"),
           ...
project.AfterInstall += project_AfterInstall;
...
staticvoid project_AfterInstall(SetupEventArgs e)
{
    if (e.IsInstalling)
    {
        // do any comprehensive analysis herestring defaultConfig = Path.Combine(e.e.InstallDir, "MyApp.exe.config.default");
        string userConfig = Path.Combine(e.e.InstallDir, "MyApp.exe.config");
        File.Copy(defaultConfig, userConfig, true);
    }
}
This way there is a clear separation of concerns and you can also decide if you want to preserve some of the user settings.
You can even abort the settings overwriting completely (e.g. during repair/reinstall).

New Post: Why is Project.AddRemoveProgramsIcon undefined in one setup project?

$
0
0
Hi, I have 2 WixSharp setup projects. In one, in accordance with one of your samples, I have this code:
        project.AddRemoveProgramsIcon = @"Files\App.ico";
        project.Manufacturer = "DesignForge, Inc.";
which compiles just fine.

In another WixSharp setup project, I also have these 2 lines of code within method Main, of file Setup.cs (your normal WixSharp project). However, here, the "AddRemoveProgramsIcon" is in red, showing the error "Project does not contain a definitiion for 'AddRemoveProgramsIcon'. Also, same for the project.Manufacturer property!

What could be going on here? I thought perhaps these were using two different versions of your compiler. However, I checked this. And each uses this to point to Wix tools:

Compiler.WixLocation = @"..\packages\WixSharp.wix.bin.3.10.1\tools\bin"; Your advice is appreciated, thank you.

James W. Hurst
email: JamesH@Designforge.com

New Post: Why is Project.AddRemoveProgramsIcon undefined in one setup project?

$
0
0
Hi James,

Could you please provide a solution sample with two conflicting projects. Otherwise I cannot reproduce/debug it. Of course please remove any sensitive content and leave it as lean as HelloWorld app.

Thank you

New Post: Why is Project.AddRemoveProgramsIcon undefined in one setup project?

$
0
0
Sure. How shall I provide this?

While I was packaging this up into a .rar file, I noticed a difference.
The one that does allow the 2 properties, references WixSharp version WixSharp.1.0.2.0\lib\net35\WixSharp.dll

The other references WixSharp.bin.1.0.44.0\lib\WixSharp.dll

New Post: Why is Project.AddRemoveProgramsIcon undefined in one setup project?

$
0
0
OK, it explains. In one of the projects you are an old interface that has been reworked dramatically about 1.5 years ago (Release v1.0.15.1). YOu should use the dedicated ControlPanelInfo member for the ARP properties. See ProductInfo sample.
var project =
    new Project("MyProduct",
        new Dir(@"%ProgramFiles%\My Company\My Product",
            new File("readme.txt")));
...
       
project.ControlPanelInfo.Comments = "Simple test msi";
project.ControlPanelInfo.Readme = "https://wixsharp.codeplex.com/manual";
project.ControlPanelInfo.HelpLink = "https://wixsharp.codeplex.com/support";
project.ControlPanelInfo.HelpTelephone = "111-222-333-444";
project.ControlPanelInfo.UrlInfoAbout = "https://wixsharp.codeplex.com/About";
project.ControlPanelInfo.UrlUpdateInfo = "https://wixsharp.codeplex.com/update";
project.ControlPanelInfo.ProductIcon = "app_icon.ico";
project.ControlPanelInfo.Contact = "Product owner";
project.ControlPanelInfo.Manufacturer = "My Company";
project.ControlPanelInfo.InstallLocation = "[INSTALLDIR]";
project.ControlPanelInfo.NoModify = true;
//project.ControlPanelInfo.NoRepair = true,//project.ControlPanelInfo.NoRemove = true,//project.ControlPanelInfo.SystemComponent = true, //if set will not be shown in Control Panel

project.BuildMsi();
I am closing this issue and if you need any further support please log an issue on GitHub.

New Post: Why is Project.AddRemoveProgramsIcon undefined in one setup project?

$
0
0
That answers it -- thank you so very much !

JH

New Post: Creating environment variables in a Project with merge modules fails.

$
0
0
I'm trying to create an environment inside of an msi that contains several merge modules. For some strange reason though, adding an environment variable to the msi causes the following error:
Unhandled Exception: System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.First[TSource](IEnumerable1 source)
at WixSharp.Compiler.GetTopLevelDir(XElement product)
at WixSharp.Compiler.ProcessEnvVars(Project wProject, Dictionary
2 featureComponents, List`1 defaultFeatureComponents
, XElement product)
at WixSharp.Compiler.GenerateWixProj(Project project)
at WixSharp.Compiler.BuildWxs(Project project, String path, OutputType type)
at WixSharp.Compiler.BuildWxs(Project project, OutputType type)
at WixSharp.Compiler.Build(Project project, String path, OutputType type)
at WixSharp.Compiler.Build(Project project, OutputType type)
at WixSharp.Compiler.BuildMsi(Project project)
at WixSharp.Project.BuildMsi(String path)
at BlastZone.Program.Main(String[] args) in C:\Users\user\Documents\Visual Studio 2015\Projects\BlastZone\BlastZone
\Program.cs:line 25
I wrote a small program to test it. This one works just fine.
static void Main(string[] args)
        {
            var feature = new Feature("somename", "somedescription");
            var dir = new Dir(@"%ProgramFiles%\somedir",
                new Merge(feature, @"D:\path\mymsm.msm"));
            var project = new Project("testproject",
                dir); 

            project.Platform = Platform.x64;
            project.PreserveTempFiles = true;
            project.BuildMsi();
        }
However, if I do this instead:
var project = new Project("testproject",
                dir, 
                new EnvironmentVariable("foo", "bar"));
My program falls over. Any idea what's causing this, and how can I fix it?

New Post: Creating environment variables in a Project with merge modules fails.

$
0
0
It's hard for me to comment your code as it is incomplete. I can only advise you to start with the working complete sample from the distro. My very simple test (below) showed no problems with combining Merge and EnvironmentVariables:
class Script
{
    staticpublicvoid Main(string[] args)
    {
        var featureA = new Feature("Feature A", "Feature A description");
        var featureB = new Feature("Feature B", "Feature B description");
        var complete = new Feature("Complete");

        complete.Add(featureA)
                .Add(featureB);

        var project =
                new Project("MyMergeModuleSetup",
                    new Dir(@"%ProgramFiles%\My Company",
                        new File(featureA, @"Files\MainFile.txt"),
                        new Merge(featureB, @"Files\MyMergeModule.msm"),
                        new Merge(featureB, @"Files\MyMergeModule1.msm")),
                    new EnvironmentVariable("foo", "bar"));

        project.DefaultFeature = complete;
        project.UI = WUI.WixUI_FeatureTree;
        project.InstallerVersion = 200; //you may want to change it to match MSM module installer version

        project.PreserveTempFiles = true;

        project.BuildMsi();
    }
}
You may use GitHub (https://github.com/oleg-shilo/wixsharp) for further discussions.

New Post: Unable to install wix_sharp using install.cmd command

$
0
0
I am getting error when I try to run install.cmd with Administrative privileges.

'cscs' is not recognized as an internal or external command,
operable program or batch file.

Please help me how to solve this error.I am new to wix sharp.

New Post: Unable to install wix_sharp using install.cmd command

$
0
0
The best to start with is to have a look at Wix# product documentation https://github.com/oleg-shilo/wixsharp. Wiki there has a few step-by-step tutorials.

As for your problem, cscs.exe is distributed along with install.cmd thus the only explanation I can come up with is that somehow you didn't extract the all files correctly.

Though, the only action that install.cmd does is setting up the environment variables. Open the file in Notepad and you will understand what it does and you will be able to do the failing step manually. But... something tells me that you may be better off with NuGet package and the VS templates as it is described on Wiki.

You can use GitHub (current project hosting) for further discussions/questions.

New Post: Unable to install wix_sharp using install.cmd command

$
0
0
I want to build a 2 page WPF UI Setup and using WixBootstrapper_UI for starting point.
When I build the project ,MSI file is not created with new UI.

I create 2 Environment variables,One is WIXSHARP_WIXDIR points to WIX_bin/bin and other is WIXSHARP_DIR points to Main WIX folder.
I will be very grateful to you.

New Post: How to Fetch install directory from WPF Application

$
0
0
I am working on bootstrapper UI as my benchmark and created new UI in WPF.
When the "Install Directory " property is changed ,I have added it in Static variables so that it can be accessed in setup.cs file.
__
Here Data variables is my static Class .I filled the values in the main screen .
But Msi file is created before user filling values.

It will be beneficial to many users as lots of user required this functionality.
__
static public void Main(string[] args)
{

    System.Windows.Forms.MessageBox.Show(DataVariables.installationFolder);


    var productProj =
        new Project("My Product",
            new Dir(DataVariables.installationFolder +@"\My Company\My Product",
                new File("readme.txt")
                )
                ) { InstallScope = InstallScope.perMachine };
    productProj.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258778");
    string productMsi = productProj.BuildMsi();

    //------------------------------------
    var bootstrapper =
            new Bundle("My Product",                    
                new MsiPackage(productMsi) { Id = "MyProductPackageId", DisplayInternalUI = false });

    System.Windows.Forms.MessageBox.Show(System.Reflection.Assembly.GetExecutingAssembly().Location.ToString());
    bootstrapper.Version = new Version("1.0.0.0");
    bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889a");
    bootstrapper.Application = new ManagedBootstrapperApplication("%this%"); // you can also use System.Reflection.Assembly.GetExecutingAssembly().Location
    bootstrapper.PreserveTempFiles = true;
    bootstrapper.Build();    
    io.File.Delete(productMsi);
}

New Post: Unable to install wix_sharp using install.cmd command

$
0
0
Envvars are truly optional. The are only needed to assist compiler with finding WiX compilation tools. However it is capable of finding them even without these variables. You can either:
  • Set special environment vars pointing to the WiX location (this is what you've done).
  • Install WiX and Wix# compiler will find it at run time.
  • Alternatively set as the first statement in your code Compiler.WixLocation=@"some path". WixLocation XML documentation has a detailed description of what this path should be.
> When I build the project ,MSI file is not created with new UI.
Bootstrapper doesn't create an MSI file but exe. Typically it is setup.exe Keep in mind that the WixBootstrapper_UI doesn't have build events setup so after building the VS project you need to run it. When you do WixBootstrapper_UI.exe invokes WiX compilers and builds setup.exe in the same Debug/Release directory where WixBootstrapper_UI.exe is.

New Post: IIS Virtual App inner folders duplication

$
0
0
DEMETRON wrote:
Hi,

My MSI installs 2 websites and 1 win service (i.e 3 directories) and everything is installing to c:\programfiles(x86)\CompanyName\ProductName
I am successfully able to add given two websites in IIS as separate webapplications.

now how to install ProductName as a website and convert 2 of the directories inside to web-application (similar to manually doing it in IIS)
Guys i still can't figure this out any help would be great.

New Post: IIS Virtual App inner folders duplication

$
0
0
This is truly a WiX challenge not a Wix# one. If you have a WiX code solution then I would be happy to look at translating it into Wix# code. But otherwise I am limited in my options. I am no expert in WiX-for-IIS.

In my opinion IIS support is one of the most over complicated (and sometimes illogically designed) areas of MSI/WiX. And that is why I couldn't provide any serious adapter-API layer for simplifying it. This Wix#-for-IIS is (not 100% but) almost 1-to-1 follows WiX-for-IIS API model.

New Post: IIS Virtual App inner folders duplication

$
0
0
oleg_s wrote:
This is truly a WiX challenge not a Wix# one. If you have a WiX code solution then I would be happy to look at translating it into Wix# code. But otherwise I am limited in my options. I am no expert in WiX-for-IIS.

In my opinion IIS support is one of the most over complicated (and sometimes illogically designed) areas of MSI/WiX. And that is why I couldn't provide any serious adapter-API layer for simplifying it. This Wix#-for-IIS is (not 100% but) almost 1-to-1 follows WiX-for-IIS API model.
thanks oleg_s problem is i started with Wix# only and have no experience with wix let me try to find if wix has a solution for this then we can think of doing the same in wix#.

New Post: How to get a Condition to work (as for deciding whether to install desktop icon) ?

$
0
0
For this one, I feel that I am very close. I want to give the user the option of whether to install the shortcut to this program on the Desktop. I am using a ManagedProject.
I see that I can add a Condition to the project thusly:

var project = new ManagedProject( "MyProgram",
                                                     new Dir(@"%Desktop%",
                                                        new ExeFileShortcut("MyProgram", "{INSTALLDIR]MyProgram.exe", "")
{
Condition = new Condition("INSTALLDESKTOPSHORTCUT=\"YES\"")
{),
new Property("INSTALLDESKTOPSHORTCUT", "YES")
);

and, lo! it does install the Desktop short when I run this installer. And if I set that Property to "NO", it does not.

Now to give the user this option, I created a new Windows.Forms ManagedForm and inserted that into the UI sequence, and that does show up..

project.ManagedUI = new ManagedUI();
project.ManagedUI.InstallDialogs.Add<WelcomeDialog>()
.Add<InstallDirDialog>()
.Add<MyNamespace.UserOptionsDialog()
.Add<ExitDialog>();

(UserOptionsDialog is the one I created).

So question to you is this: How, do I set the value of that Property, from within UserOptionsDialog?

Within any of the event-handlers within UserOptionsDialog, I can set
MsiRuntime.Data["INSTALLDESKTOPSHORTCUT"] = "YES"
for example, but that does not set the Property.
Within your MsiRuntime class, I do not see any Property properties. ?

One other Question: When defining the ExeFileShortcut like this, how do you assign the Icon file to it?

Previously I had added the desktop-shortcut to the project this way:

var desktopShortcut = new FileShortcut("MyProduct", "%Desktop%");
desktopShortcut.IconFile = "App.ico";
project.FileFile((f) => f.Name.EndsWith("MyProduct.exe"))
.First()
.Shortcuts = new[]
    {
        desktopShortcut,
        programMenuShortcut
    };
}
and that did work just fine, plus it put the Icon on the desktop shortcut.
However, when I try to add a Condition to that FileShortcut, when I build it it throws an exception complaining that I should not add a Condition to that.

?

Meantime, thank you for building and sharing this wonderful project -- it is indeed being quite useful to me now.

New Post: How to get a Condition to work (as for deciding whether to install desktop icon) ?

$
0
0
> How, do I set the value of that Property,
Like this.
MsiRuntime.Session["INSTALLDESKTOPSHORTCUT"] = "YES"
Data is a custom data dictionary that Wix# mainaines so user defined properties (not MSI) properties can be kept all the way till (and including) after-install deferred actions. And it has been developed to overcome that ridiculous MSI design flaw that the MSI properties are all destroyed before MSI runtime launches any after-install deferred action. Though in your case you have no use for MsiRuntime.Data as your property is going to be consumed by MSI runtime but not by the ueser-defied routine (e.g. another custom action). Thus you have to assign properties the way WiX intended - by using Session indexer.

By the way <WixSharp>/Samples/ManagedSetup/CustomUIDialog shows exactly your scenario except it is a password string property not boolean as yours.

Unrelated... I see you are battling with CodePlex markup syntax. I know, :), unexplainably they are using two different wiki engines within a single website (discussions and releases). Here you need to use ```C# not {code:c#} tag. And if you mix them together none is working.

On GitHub it's all simple. Single syntax for everything.
Viewing all 1354 articles
Browse latest View live


Latest Images