XSharp in VSCode

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
Fabrice
Posts: 632
Joined: Thu Oct 08, 2015 7:47 am
Location: France

XSharp in VSCode

Post by Fabrice »

Hi Guys,

If you have been attending our latest Summit in Potsdam, you have seen my demo of X# Integration in Visual Studio Code.

To celebrate the forth coming of XSharp 3.0, I'm happy to announce that a version is now freely and publicly available.

For now, you can download it at my homepage : http://www.fabtoys.net
Unzip the downloaded file, then in VSCode open the Extension panel (Ctrl + Shift + X), then click on the "Views and More Actions" button on the top-right (...) and select the last item "Install from VSIX".
Open a PRG file (and get the syntax coloring and more), open a .xsproj and right-click on it to build, run, and with a .NET SDK format get access to all the Settings
XSharp Development Team
fabrice(at)xsharp.eu
stecosta66
Posts: 113
Joined: Mon Sep 26, 2016 12:59 pm
Location: Italy

Re: XSharp in VSCode

Post by stecosta66 »

Hi Fabrice,

just a quick note about the new XSharp Tools extension.

After VS Code auto-updated the extension, my current X# 2.24.0.1 (FOX subscription) / .NET Framework 4.8.1 solution stopped building correctly, because the new extension uses `dotnet build`, which picked up the .NET 10 SDK in my environment. My WinForms project then failed with resource-related errors such as `MSB3822` and `MSB3823`.

I later noticed the note about SDK-style projects and X# 3.0, so this is expected. I downgraded to the previous extension version (0.4.8) and my current setup works again.

It might be useful to make this clearer in the README/release notes, especially for users with VS Code extension auto-update enabled and traditional `.xsproj` / .NET Framework projects.

Thanks for your work. I look forward to using the new extension once X# 3.0 is officially released.

Ciao
Stefano
User avatar
Fabrice
Posts: 632
Joined: Thu Oct 08, 2015 7:47 am
Location: France

Re: XSharp in VSCode

Post by Fabrice »

Hi Stefano,
Many thanks for your message and feedback.

In fact, X#3 is (should be) needed "only" for the project settings, as the extension is "only" able to read/modify SDK projects correctly. (I may have add too much options ! :) )
That said, the XSharp tools settings (dialect used for coloring, formatting options, etc) are used by the LSP Server that is self-contained, so it is version agnostic.

Regarding the build command, it is using "dotnet build" in v0.6 as in v0.4... So I must have changed something by accident; I will check.

Thanks again
XSharp Development Team
fabrice(at)xsharp.eu
stecosta66
Posts: 113
Joined: Mon Sep 26, 2016 12:59 pm
Location: Italy

Re: XSharp in VSCode

Post by stecosta66 »

Hi Fabrice,

I found the actual cause.

It was not a difference in the build command between extension versions. My workspace already has a `.vscode/tasks.json` default build task that explicitly calls Visual Studio MSBuild:

`C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\amd64\MSBuild.exe`

with my `ModernUI.xsproj`, `/p:Configuration=Debug`, `/p:DeployDir=C:\ADMWINNETSQL\`, `/m`, and `/t:Build`.

After installing the newer XSharp Tools extension, `Ctrl+Shift+B` was being handled by the extension command `Build XSharp Project` when an XSharp file was active (`resourceLangId == 'xsharp'`). That opened the “Select XSharp project” quick-pick and then used the extension build path, which in my environment went through the .NET 10 SDK and failed on my traditional .NET Framework 4.8.1 WinForms project with MSB3822/MSB3823.

I changed the keybinding locally:

* `Ctrl+Shift+B` is now back to the standard VS Code `Tasks: Run Build Task`
* `Build XSharp Project` is now on `Ctrl+Shift+Alt+B`

With this setup, the new extension can stay installed and my existing ADM build workflow works correctly again.

So this was mainly a keybinding precedence issue in my environment, because I already had a custom workspace build task.

Thanks again for your help.

Ciao
Stefano
User avatar
Fabrice
Posts: 632
Joined: Thu Oct 08, 2015 7:47 am
Location: France

Re: XSharp in VSCode

Post by Fabrice »

Hi Stefano,

thanks for the info.

I will see if I can do something in that situation (message, ...); and also indicte that in the Readme.
XSharp Development Team
fabrice(at)xsharp.eu
stecosta66
Posts: 113
Joined: Mon Sep 26, 2016 12:59 pm
Location: Italy

Re: XSharp in VSCode

Post by stecosta66 »

Hi Fabrice,

just a small follow-up.

I also checked the README and everything now makes sense.

The behaviour I saw is consistent with the documented changes:
- Ctrl+Shift+B is assigned to the XSharp build command when an XSharp file is active.
- In a multi-project workspace, it opens the .xsproj quick-pick.
- The extension build path uses dotnet build.

In my workspace I already had Ctrl+Shift+B associated with the standard VS Code build task, which calls Visual Studio MSBuild.exe through tasks.json. I solved the conflict locally by moving the XSharp Tools build command to Ctrl+Shift+Alt+B and keeping Ctrl+Shift+B for Tasks: Run Build Task.

I also fixed my formatter warning: my settings had the wrong extension id, “XSharp BV.xsharp-tools” instead of “XSharp-BV.xsharp-tools”.

One small note: the README says the language server is self-contained, but on one machine running XSharpLanguageServer.exe manually required Microsoft.NETCore.App 8.0.0 to be installed. After checking my main machine, where .NET 8 runtime is installed, the LSP works and I now have hover, references, CodeLens and Go to Definition.

So everything is working on my side now.

Ciao
Stefano
Post Reply