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

Syntax error in aot.entrypoints.cs due to backtick and plus sign in class names #1748

Open
dwilches opened this issue Feb 13, 2025 · 2 comments

Comments

@dwilches
Copy link

dwilches commented Feb 13, 2025

Hello,

I'm getting errors like these in the aot.entrypoints.cs file:

5>aot.entrypoints.cs(98,35): Error CS1026 : ) expected [bin\Debug\aot.WixSharp\WixSharp.aot.csproj]
5>aot.entrypoints.cs(98,35): Error CS1002 : ; expected [bin\Debug\aot.WixSharp\WixSharp.aot.csproj]
5>aot.entrypoints.cs(98,35): Error CS1056 : Unexpected character '`' [bin\Debug\aot.WixSharp\WixSharp.aot.csproj]
5>aot.entrypoints.cs(98,37): Error CS1002 : ; expected [bin\Debug\aot.WixSharp\WixSharp.aot.csproj]
5>aot.entrypoints.cs(98,37): Error CS1513 : } expected [bin\Debug\aot.WixSharp\WixSharp.aot.csproj]

Looking at line 98, I see the class name has a backtick:

typeof(WixSharp.StringEnum`1).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);

So the syntax errors seem to be caused by the presence of the type name of a generic class with 1 parameter?

I tried setting the language level in my csproj to <LangVersion>default</LangVersion> to use the latest one, but it didn't help.

These are the other file names that are giving me syntax erros, some have backticks and some have plus signs:

        typeof(WixSharp.CustomDialogWith`1).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.SerializingExtensions+Property).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.SerializingExtensions+Property).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.Compiler+OutputType).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.Compiler+ToolsOutputReceivedEventHandler).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.Compiler+Wildcard).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.IISCertificate+CertificateStoreLocation).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.IISCertificate+CertificateStoreName).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.InternetShortcut+ShortcutType).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.ManagedProject+SetupEventHandler).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.ManagedProject+UnhandledExceptionEventHandler).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.SetupEventArgs+SetupMode).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.SetupEventArgs+AppData).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.WebSite+WebAddress).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.WixGuid+SequentialGuid).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.Nsis.Compressor+Method).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.Nsis.Compressor+Options).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.CommonTasks.Tasks+DowngradeErrorCheck).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);
        typeof(WixSharp.CommonTasks.Tasks+NativeWindow).GetMembers(Public | NonPublic | FlattenHierarchy | Static | Instance | InvokeMethod);

By the way, there is a typo in the class name AotEnrtyPoints instead of AotEntryPoints.

The Wix# version I'm using is 2.5.1, although I tried 2.3.1 and I get the same error. And I'm targeting net8.0-windows

Thanks.

@oleg-shilo
Copy link
Owner

Hi Daniel, unfortunately, what you are trying to do is not supported.

If I am not mistaken, you are trying to AOT compile WixSharp.UI.dll assembly and this is what triggers the problem.
For any UI you still have to use .NETFramework

Image

The reason for this is rather logical than technical. If you try to distribute the .NET Core managed UI with your setup it means that it needs to AOT compile it. This, in turn, meant the AOT will try to pack into your native *.aot.dll not only CLR but also complete WinForms (or WPF). Having such fat masi does not make any sense. For UI scenarios you are definitely much better off with te .NET Framework WixSharp build. Remember, all this struggle is because WiX does not support .NET Core. Only .NET Framework

Your setup definition can be .NET Core assembly compiled with AOT switch but the UI is the usual WixSharp custom UI assembly as per any template. You can find the sample for this here.

While I have provided the working sample, I did not create the VS project template for this very scenario as I did want to encourage the users to build UI this way. Simply because I do not believe it offers an adequate dev experience. :(

@dwilches
Copy link
Author

dwilches commented Feb 14, 2025

Thanks for your answer @oleg-shilo

In the link you shared it says:

Scenario 4 is supported as a hybrid solution when the msi is built with .NET Core (currently supported) and the UI is built as a .NET Framework assembly and simply referenced from the msi as an external EmbeddedUI assembly. See this sample.

Was it a typo and it's meant to say "Scenario 5" (Embedded UI)?

Our purpose with upgrading WixSharp to use net8 was because we're upgrading our app from .Net Framework 4.6 to .Net 8.0, and we saw the opportunity to upgrade the installer code too. But it's being a little difficult. Is there any limitation of WixSharp 1.2.6 to deploy applications that are built for .Net 8.0? We're thinking on leaving the installer on an older version than our actual program.

For example I wonder if lines like these would not work 100% of the times as we would be trying to enforce a higher version of .Net than the installer knows about:

project.SetNetFxPrerequisite(
    "WIX_IS_NETFRAMEWORK_462_OR_LATER_INSTALLED",
    "This application requires .NET Framework 4.6.2.");

Thank you,

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