Skip to content
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

FileSearch #233

Closed
Xaddan opened this issue Dec 8, 2017 · 5 comments
Closed

FileSearch #233

Xaddan opened this issue Dec 8, 2017 · 5 comments

Comments

@Xaddan
Copy link
Contributor

Xaddan commented Dec 8, 2017

It looks like Wix# does not support FileSearch.
Can you implement it? I think I can not handle it. :)
Example:

<Property Id="SQL_BROWSER_LOCATION">
   <RegistrySearch Id="SQL_BROWSER_LOCATION" Root="HKLM" Key="SYSTEM\CurrentControlSet\services\SQLBrowser" Name="ImagePath" Type="file">
      <FileSearch Name="sqlbrowser.exe"/>
   </RegistrySearch>
</Property>
@oleg-shilo
Copy link
Owner

oleg-shilo commented Dec 9, 2017

Correct. It does not.

File/Registry/Component/Directory/IniFile Search is one of those convoluted MSI concepts that MS had to go with due to the MSI limitations. WixSharp lifts manu of those limitations and now one can have a proper routine with complex condition and flow control.

Look how cleaner, more natural and more intuitive it can be done with WixSharp:

static public void Main(string[] args)
{
    var project = new ManagedProject("DreamProduct",
           ...
    project.AfterInstall += session =>
    {
        var browser_exe = (string)Registry.GetValue(@"SYSTEM\CurrentControlSet\services\SQLBrowser",
                                                     "ImagePath", null);
        if (File.Exists(browser_exe))
            Process.Start(browser_exe);
    };

Don't want to use ManagedProject? Still can do...

static public void Main(string[] args)
{
    var project = new Project("CustomActionTest",
           ...
            new ManagedAction(CustomActions.StartSQLBrowser, ... Condition.NOT_Installed));
...

public class CustomActions
{
    [CustomAction]
    public static ActionResult StartSQLBrowser(Session session)
    {
        var browser_exe = (string)Registry.GetValue(@"SYSTEM\CurrentControlSet\services\SQLBrowser",
                                                     "ImagePath", null);
        if (File.Exists(browser_exe))
            Process.Start(browser_exe); 
         return ActionResult.Success;
    }
}

Saying that, I already have compromised once for RegistrySearch, which is implemented as RegValueProperty, I guess I can do something similar for FileSearch. But I really don't want to repeaat MSI mistakes. WixSharp supposed to be a 'better WiX' but not the same but with C#.

Thus I am putting it for voting. If community up votes this feature request, then be it.

@oleg-shilo
Copy link
Owner

Change of heart... :)

After some more considerations I decided to proceed with this feature. Nothing has changed. I do believe the MSI/WiX API paradigm is rather faulty, but...

I cannot ignore the fact that some users are facing the task of porting legacy WiX solutions. In some cases using managed Custom Actions can also be difficult (hard to imagine but...). Thus accomplishing the tasks in such cases can be difficult.

Anyway, I scheduled it for the next release.

oleg-shilo added a commit that referenced this issue Dec 10, 2017
@oleg-shilo
Copy link
Owner

Done. Will be available in the next release:

new Property("SQL_BROWSER_LOCATION",
    new RegistrySearch(RegistryHive.LocalMachine, @"SYSTEM\CurrentControlSet\services\SQLBrowser", "ImagePath", RegistrySearchType.file,
        new FileSearch("sqlbrowser.exe")))

@Xaddan
Copy link
Contributor Author

Xaddan commented Dec 11, 2017

Great news. Thank you so much.

@oleg-shilo
Copy link
Owner

This opens the gates for the implementation of all other *Search classes if the need arises.

oleg-shilo added a commit that referenced this issue Jan 12, 2018
----
* Migration of WixSharp types to IGenericEntity model:
	* Rework Certificate using IGenericEntity
	* Rework SqlDatabase, SqlString and SqlScript using IGenericEntity
	* Rework DriverInstaller using IGenericEntity
	* Rework FirewallException using IGenericEntity
	* Rework EnvironmentVariable using IGenericEntity
	* Rework FirewallException using IGenericEntity
	* Rework User using IGenericEntity
	* Rework IniFile using IGenericEntity

* Added support for new WiX types:
	* CloseAppplication
	* RemoveRegistryKey

* Defect fixes:
	* Issue #258: WixSharp doesn't remove temporary files if custom output name is specified
	* Issue #251: Passing UseCertificateStore parameter from DigitalSignatureBootstrapper
	* Issue #247: Handling null TimeUrl
	* Issue #251: Passing UseCertificateStore parameter from DigitalSignatureBootstrapper through to DigitallySign
	* Issue #233: FileSearch
	* Issue #230: CustomAction Condition extension
	* Issue #226: Project.HashedTargetPathIdAlgorithm generates invalid ids

* Various improvements and minor fixes:
	* Fixed the problem with EnvironmentVariable not having XML parent when it is hosted by the component-less WiX (e.g. ConsumingMergeModule sample).
	* CustomAction.UsesProperties & .RollbackArgs space trimming
	* Trim all spaces around properties (name and value) before passing to msi
	* CommonTasks.InstallService fix & new overload
	* Fixed installService args location, added overload that accepts username and password
	* Added `WixObject.MapComponentToFeatures` to assist with implementation of IGenericEntity based WiX objects.
	* fix "CustomActionRef.When" property handling in compile.
	* change to use just WixSharp.When.ToString()
	* fix CustomActionRef will add "Before" attribute in Custom Element even if set When.After
	* Added extension methods for
	  - `Project.Add(IGenericEntity[])`
	  - `File.Add(IGenericEntity[])`
	  - `Dir.Add(IGenericEntity[])`

* AppVeyor integration (https://ci.appveyor.com/project/oleg-shilo/wixsharp)
oleg-shilo added a commit that referenced this issue Jan 12, 2018
----
* Migration of WixSharp types to IGenericEntity model:
    * Rework Certificate using IGenericEntity
    * Rework SqlDatabase, SqlString and SqlScript using IGenericEntity
    * Rework DriverInstaller using IGenericEntity
    * Rework FirewallException using IGenericEntity
    * Rework EnvironmentVariable using IGenericEntity
    * Rework FirewallException using IGenericEntity
    * Rework User using IGenericEntity
    * Rework IniFile using IGenericEntity

* Added support for new WiX types:
    * CloseAppplication
    * RemoveRegistryKey

* Defect fixes:
    * Issue #258: WixSharp doesn't remove temporary files if custom output name is specified
    * Issue #251: Passing UseCertificateStore parameter from DigitalSignatureBootstrapper
    * Issue #247: Handling null TimeUrl
    * Issue #251: Passing UseCertificateStore parameter from DigitalSignatureBootstrapper through to DigitallySign
    * Issue #233: FileSearch
    * Issue #230: CustomAction Condition extension
    * Issue #226: Project.HashedTargetPathIdAlgorithm generates invalid ids

* Various improvements and minor fixes:
    * Fixed the problem with EnvironmentVariable not having XML parent when it is hosted by the component-less WiX (e.g. ConsumingMergeModule sample).
    * CustomAction.UsesProperties & .RollbackArgs space trimming
    * Trim all spaces around properties (name and value) before passing to msi
    * CommonTasks.InstallService fix & new overload
    * Fixed installService args location, added overload that accepts username and password
    * Added `WixObject.MapComponentToFeatures` to assist with implementation of IGenericEntity based WiX objects.
    * fix "CustomActionRef.When" property handling in compile.
    * change to use just WixSharp.When.ToString()
    * fix CustomActionRef will add "Before" attribute in Custom Element even if set When.After
    * Added extension methods for
      - `Project.Add(IGenericEntity[])`
      - `File.Add(IGenericEntity[])`
      - `Dir.Add(IGenericEntity[])`

* AppVeyor integration (https://ci.appveyor.com/project/oleg-shilo/wixsharp)
@Xaddan Xaddan closed this as completed Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants