profile
viewpoint
Oleg Shilo oleg-shilo Leica Biosystems Australia

oleg-shilo/cs-script 1129

C# scripting platform

oleg-shilo/cs-script.npp 167

CS-Script (C# Intellisense) plugin for Notepad++ (x86/x64)

oleg-shilo/cs-script.core 89

.NET Core port of CS-Script

oleg-shilo/codemap.vscode 41

Code map (syntax tree) of the active document

oleg-shilo/cs-script.vscode 22

VSCode extension for CS-Script

oleg-shilo/Favorites.vscode 14

VSCode extension for managing Favorites

oleg-shilo/CodeMaidPlus 11

A simple extension that attempts to address some shortcomings of rather excellent CodeMaid.

oleg-shilo/cs-script-sublime 8

Sublime Text 3 plugin for CS-Script

oleg-shilo/multiclip 8

MultiClip

issue closedoleg-shilo/wixsharp

Community Message

Hi all WiSharp users.

Just wanted to let you all know that the recent drop in my activity in supporting and evolving WixSharp is caused by an unfortunate spike in my other personal and professional commitments.

The situation is slowly improving but now I am facing a serious backlog particularly in my another main stream project CS-Script. It is due to be merged with its parallel stream CS-Script.Core. And the recent release of .NET5 pushed this effort to the highest priority.

Thus I apologize for my patchy availability for WixSharp.

Cheers, Oleg

closed time in 3 days

oleg-shilo

issue closedoleg-shilo/wixsharp

ComponentCondition doesn't work for InternetShortcut

I'm in the process of building an installer using a WixSharp ManagedUI. One of the things I am doing is optionally allowing the user to add a shortcut to the desktop and/or the Windows start menu. The shortcut is to a web URL, so I'm using the InternetShortcut class to generate the appropriate WixEntity. Here's the relevant piece of my Program.cs file (I've replaced sensitive data with obvious stand-ins, like "some.site.com"):

new Dir(@"%ProgramMenu%", new InternetShortcut {
    Name = $"MyApplication",
    Target = "http://some.site.com/",
    Type = InternetShortcut.ShortcutType.link,
    ComponentCondition = Condition.Create("CREATE_START_MENU_SHORTCUT=\"True\""),
    AttributesDefinition = @"IconFile=[INSTALLDIR]\app_icon.ico;IconIndex=0"
})

As you can see, I'm trying to create a condition via the ComponentCondition property. This code compiles, but when I look at the resulting .wxs file, there is no <Condition></Condition> element in the <Component> that contains the <InternetShortcut>. I decided to try the same thing with the new File() constructor and a dummy file, like this:

new File($"{ProjectPaths.InstallerRoot}dummy.txt"){
    Condition = Condition.Create("CREATE_START_MENU_SHORTCUT=\"True\"")
}

This worked just as I expected and created the following XML:

<Component Id="Component.dummy.txt_40103223" Guid="6fe30b47-2577-43ad-9095-18617f305a4d" Win64="yes">
    <Condition>CREATE_START_MENU_SHORTCUT="True"</Condition>
    <File Id="dummy.txt_40103223" Source="dummy.txt" />
</Component>

I was able to able to get around this issue by manually adding XML elements to the .wxs file, like this:

project.WixSourceGenerated += document => {
    var index = 0;
    document.FindAll("InternetShortcut").ForEach(element => {
        if (index < 1) {
            element.Parent.AddElement("Condition", "", "CREATE_START_MENU_SHORTCUT=\"True\"");
            index++;
        }
        else {
            element.Parent.AddElement("Condition", "", "CREATE_DESKTOP_SHORTCUT=\"True\"");
        }
    });
};

I am adding two shortcuts, so hence the forEach(). This works as expected, and each <Component> containing an <InternetShortcut/> now has a <Condition> element with my desired condition inside it. Not a problem to do it this way, but it would be nice if I could use ComponentCondition instead.

closed time in 3 days

GarrenMiller

issue closedoleg-shilo/wixsharp

MSM project type does not support the Dependency tag

Merge modules support Dependencies as a tag, which allows merge modules to depend on other merge modules, as seen here: https://wixtoolset.org/documentation/manual/v3/xsd/wix/dependency.html

closed time in 3 days

sonicbhoc

issue closedoleg-shilo/wixsharp

Please include a build guide for the NuGet package

I would like to build this as a package, but my attempts so far have all failed. I would suggest either a build guide or a script to be written.

I would also suggest moving to the simplified SDK Project Format to simplify package creation, if possible. This would enable usage of the dotnet command line tool and allow contributions from non-Windows users without WINE or other work-arounds. This would be a LOT of work, which is why I'm only mentioning it off-hand and didn't make a task for it (yet), but it's something that might be worth pursuing.

closed time in 3 days

sonicbhoc

issue closedoleg-shilo/wixsharp

Use .gitattributes to enforce line endings, mark binaries, and configure diff settings

.gitattributes provides end-of-line standardizations and the ability to enhance diffs based on file type. I suggest looking into it: https://www.git-scm.com/docs/gitattributes

I would not mind writing one for the repo if time allows.

closed time in 3 days

sonicbhoc

issue closedoleg-shilo/wixsharp

Replace redundant Extension, MIME, and Verb classes with FileAssociation

FileAssociation should implement IGenericEntity and the Extensions member of ProgId should be changed to type FileAssociation[].

In ProcessDirectoryFiles (starting at line 1749), the processing for FileAssociation should be moved to FileAssociation.Process and compiler should use the ProgId class to simplify the function.

When I was fleshing out the ComRegistration.cs classes, I didn't realize that FileExtension was a simplified version of the Extension/MIME/Verb hierarchy or I would have used it instead.

closed time in 3 days

sonicbhoc

issue closedoleg-shilo/wixsharp

Simplify ProgID registration for COM Classes

To reduce the amount of boilerplate code (arrays with single entries), introduce members ProgId and VersionIndependentProgId to ComRegistration class. This makes it easier to understand and harder to mix up (as even the COM Registration example provided in the repo has the version-dependent ProgId listed as the version-independent ProgId).

If those fields aren't set, the current behavior should be followed. Otherwise, the existing ProgIds field should be exclusively for aliases.

This is just a suggestion, and might not be as useful as I imagine, but I figure it couldn't hurt to offer it up as an enhancement. If you decide that it would be beneficial, I would be willing to do this task.

closed time in 3 days

sonicbhoc

issue closedoleg-shilo/wixsharp

Question: License file with BuildMultilanguageMsi

Hello,

I'm happy to see the BuildMultilanguageMsi has been implemented in the library. I had created a similar solution, using some VBS scripts included in the Windows 10 SDK, resulting in my own library that complements and is largely based on your WixSharp library.

One of the things that I needed to change for every language was the Project.LicenceFile, in my case having 2 different files, one english and one french. Having looked at your approach, do you think you can include such a property to the ProjectLocalization class so it can then be bound to the project when each MSI is being built?

Just as a side note, I had taken a slightly different approach as I added a delegate function as a parameter, exposing the Project instance, so any of it's properties can be changed before it gets built, similar to your BindTo:

.Build("en-US", project => project.LicenceFile = "license.English.rtf")
.Build("fr-CA", project => project.LicenceFile = "license.French.rtf")

.MakeMultiLingual();

Thanks.

closed time in 3 days

gcostanzo

issue closedoleg-shilo/wixsharp

Missaligned UI when using a 4K display with 200% Windows scaling

Hey,

Using the example code from the wiki, I am getting a missplaced text: image

closed time in 3 days

JPVenson

issue commentoleg-shilo/wixsharp

Upgrade button - how to?

I suggest you use ManagedUI project created from CustomUI VS template. This way you will have access to the all UI elements (e.g. buttons) and will be able to create any customization.

RachelXGanon

comment created time in 3 days

issue commentoleg-shilo/wixsharp

Setting RegistrySearch Id causes infinite loop

Yes it is a bug :( A very nasty typo. Thank you for reporting.

Fixed

Until the fix is published please use base class to set the property.

austinw-fineart

comment created time in 3 days

push eventoleg-shilo/wixsharp

oleg.shilo

commit sha 0ef9a962d66273c2ddc578fb58b73daf5689a1ec

- Issue #1096: Setting RegistrySearch Id causes infinite loop

view details

push time in 3 days

issue commentoleg-shilo/wixsharp

WixSharp not generate .wxs file

I suggest you create your VS project from one of the WixSharp project templates. This will warranty the correct creation of the wxs file.

RachelXGanon

comment created time in 3 days

push eventoleg-shilo/cs-script

oleg.shilo

commit sha e0f98cf9fef14c65fe7f159e7d6a3163f3473e1c

- Issue #260: Double Entry Point Definition (corrected fix)

view details

push time in 11 days

issue commentoleg-shilo/cs-script

Double Entry Point Definition

Indeed it is a defect. Thank you. Fixed. Will be available in the very next release.

husk3r

comment created time in 11 days

push eventoleg-shilo/cs-script

oleg.shilo

commit sha aa2035930f4a0e2b2856e34f1366bee99b3894fa

- Issue #260: Double Entry Point Definition

view details

push time in 11 days

issue commentoleg-shilo/wixsharp

Intermittent error

This is an assembly loading error that by default is reported by CLR this way. What it means that ManagedUI assembly was not able to load as some ot it's dependencies are missing. The most usual case is that your UI assembly is referencing other assembly (e.g. you added it to the project) that is not added to the msi.

Is it your case?

malicuss

comment created time in 15 days

issue commentoleg-shilo/wixsharp

Intermittent error

Please let me know if it addressed the problem you are experiencing and I will make a full release

malicuss

comment created time in 17 days

issue commentoleg-shilo/wixsharp

Intermittent error

Hi Kosta,

It is really strange problem. The stack trace indicates that the exception is raised by the Single() call in InvokeClientHandler method.

However it never invokes any LINQ expression at all:

https://github.com/oleg-shilo/wixsharp/blob/61777afd40936ddcf5114edbea9ceb708a350da1/Source/src/WixSharp/ManagedProject/ManagedProject.cs#L522-L530

Strangely enough GetHandler(string info) (one step deeper) has a few calls to Single and in fact there is a nasty typo there that potentially leads to the probing exception at runtime.

I have fixed it. The fix is published on GitHub and Nuget as a pre-release:

Install-Package WixSharp.bin -Version 1.19.1-pre
malicuss

comment created time in 17 days

release oleg-shilo/wixsharp

v1.19.1.0-pre

released time in 17 days

created tagoleg-shilo/wixsharp

tagv1.19.1.0-pre

Framework for building a complete MSI or WiX source code by using script files written with the C# syntax.

created time in 17 days

created tagoleg-shilo/wixsharp

tagv1.19.0.0

Framework for building a complete MSI or WiX source code by using script files written with the C# syntax.

created time in 17 days

push eventoleg-shilo/wixsharp

oleg.shilo

commit sha 9423ad2d4e00fdfa23fd675de0f0fa9a4b447297

- Issue #1087: Intermittent error

view details

push time in 17 days

issue commentoleg-shilo/wixsharp

detect if upgrade succeed or not

Do you think WixSharp/Wix implement a rollback to the previous version ? I do not think so. It is in fact MSI (not even WiX) who is responsible for the upgrade implementation. And for the major upgrade scenario it uninstalls the prev version (version A) and then tries it install the new one (*version B). If the installation fails half ways through then it rolls back the installation of version B. But not the uninstall of version A.

RachelXGanon

comment created time in 18 days

issue closedoleg-shilo/cs-script

Classless evaluation

Hi, I want to treat global scope as body of entry function, so every statement will be executed as is, but classes and namespaces to be declared normally. So this code will be executed:

using System;

void Test()
{
    Console.WriteLine("Test()");
}

class SomeClass
{
    void Foo()
    {
        Console.WriteLine("Foo()");
    }
}

Test();
new SomeClass().Foo();
Console.WriteLine("Global scope");

Is it possible to achieve this using cs-script from .net application?

Thanks.

closed time in 19 days

amadare42

issue closedoleg-shilo/cs-script

Relative path for cscs.exe -out option results in wrong output folder

To reproduce:

PS C:\Workspaces\CSScript\Issue #255> .\cscs.exe -cd -out:.\Some\Lib.dll .\Some\Lib.cs
Created: .\Some\Lib.dll
PS C:\Workspaces\CSScript\Issue #255> cd .\Some\
PS C:\Workspaces\CSScript\Issue #255\Some> dir                                                            

    Verzeichnis: C:\Workspaces\CSScript\Issue #255\Some


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       23.09.2021     15:24                Some
-a----       21.09.2021     18:45            110 Lib.cs


PS C:\Workspaces\CSScript\Issue #255\Some> cd .\Some\
PS C:\Workspaces\CSScript\Issue #255\Some\Some> dir                                                       

    Verzeichnis: C:\Workspaces\CSScript\Issue #255\Some\Some


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       23.09.2021     15:24          10240 Lib.dll


PS C:\Workspaces\CSScript\Issue #255\Some\Some>                                                           

Instead of .\Some\Lib.dll, output goes to .\Some\Some\Lib.dll.

Reference:

PS C:\Workspaces\CSScript\Issue #255> .\cscs.exe
C# Script execution engine. Version 3.30.5.2.
Copyright (C) 2004-2018 Oleg Shilo. www.csscript.net (github.com/oleg-shilo/cs-script)

   CLR:             4.0.30319.42000 (.NET Framework v4.8 or later)
   System:          Microsoft Windows NT 6.2.9200.0
   Corlib:          C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll
   Architecture:    x64
   Install dir:     <not integrated>
   Location:        C:\Workspaces\CSScript\Issue #255\cscs.exe
   Config file:     C:\Workspaces\CSScript\Issue #255\css_config.xml
   Compiler:        <default>
   NuGet manager:   C:\Programs\NuGet\nuget.exe
   NuGet cache:     C:\ProgramData\CS-Script\nuget

I'll attach the files in a minute.

closed time in 19 days

maettu-this

issue closedoleg-shilo/cs-script

Script merger for hosted scripts

Hello Oleg,

first of: thank you for your continued work on the cs-script project, I am using it to host scripts in a desktop application to provide a scripting interface for users. I am going with the Roslyn compiler so that users won't need an additional SDK. For ease of mantainance I´d like to deploy scripts with multiple files, which is not natively possible with the Roslyn compiler according to your documentation. However, I have seen that you have included script merging in the CLI version of CS-Script. Is there any reason why this feature is only available in the CLI version? Do you plan to include this script merger in the hosting version as well?

closed time in 19 days

JayBeAl

issue closedoleg-shilo/cs-script

System.NullReferenceException: Object reference not set to an instance of an object.

OS: Windows 10 dotnet version: 5.0.400

Step to reproduce: run the sample code.

using System;
using CSScriptLib;

var calc = CSScript.Evaluator
    .LoadCode<ICalc>(@"using System;
                                    public class Script
                                    {
                                        public int Sum(int a, int b)
                                        {
                                            return a+b;
                                        }
                                    }");
var result = calc.Sum(1, 2);
Console.WriteLine(result);

public interface ICalc {
    int Sum(int a, int b);
}

Output:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at CSScriptLib.EvaluatorBase`1.LoadCode[T](String scriptText, Object[] args)
   at <Program>$.<Main>$(String[] args) in E:\Monorepos\test-driven-design\Main.cs:line 4

closed time in 19 days

donaldnevermore

issue closedoleg-shilo/cs-script

.net 5 error for publish Single file application

Value cannot be null. (Parameter 'path') at System.IO.Path.GetFullPath(String path) at CSScriptLib.EvaluatorBase1.<>c.<GetReferencedAssemblies>b__28_1(String x) at System.Linq.Enumerable.SelectArrayIterator2.MoveNext() at System.Linq.Set1.UnionWith(IEnumerable1 other) at System.Linq.Enumerable.DistinctIterator1.FillSet() at System.Linq.Enumerable.DistinctIterator1.ToArray() at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at CSScriptLib.EvaluatorBase1.GetReferencedAssemblies(String code, String[] searchDirs) at CSScriptLib.EvaluatorBase1.ReferenceAssembliesFromCode(String code, String[] searchDirs) at CSScriptLib.RoslynEvaluator.Compile(String scriptText, String scriptFile, CompileInfo info) at CSScriptLib.EvaluatorBase1.CompileCode(String scriptText, String scriptFile, CompileInfo info) at CSScriptLib.EvaluatorBase`1.CompileCode(String scriptText, CompileInfo info) at Server.GetScripts(DirectoryInfo dirInfo) at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

closed time in 19 days

shshshdy
more