AvaloniaVSCode icon indicating copy to clipboard operation
AvaloniaVSCode copied to clipboard

Preview and completion does not work: No executable project found

Open Ruttie2006 opened this issue 6 months ago • 2 comments

Describe the bug

I'm having trouble with the VSCode previewer and code completion (I primarily want the code completion). When trying to code complete, I get the message 'Build the project', pressing enter does nothing. Manually executing the 'Create previewer assets' command through the command palette also does nothing.

To Reproduce

Simply executing 'Create previewer assets' or pressing enter when prompted to build project by autocomplete.

Avalonia for VS Code

v0.0.32

Avalonia version

v11.3.0

VS Code version

No response

Relevant log output

2025-06-05 23:47:48.643 [info] [EXT - INFO] Solution data path path: /tmp/PROJECT_NAME.json
2025-06-05 23:47:48.864 [info] parser process args: /bin/sh,-c,"/usr/share/dotnet/dotnet" "/home/ruttie/.vscode/extensions/avaloniateam.vscode-avalonia-0.0.32/solutionParserTool/SolutionParser.dll" "/home/ruttie/PROJECT_FOLDER_PATH"
2025-06-05 23:47:49.038 [info] parser process exited with code 0
2025-06-05 23:47:49.038 [info] No executable project found.

Additional context

The project's OutputType is set to WinExe. The used .net version is net9.0. Executing the 'Create previewer assets' command when vscode only has the project open does work, but deleting the incorrect sln file and going one folder back results in no actual change. (My project structure is Name.sln + Name/Name.csproj, opening vscode on Name.csproj means a Name.sln file is created in the same directory, while I want it one folder back). PROJECT_FOLDER_PATH in the above trace refers to the folder that contains the .sln file (not the .csproj file). The .csproj is part of the .sln file (created using dotnet new sln + dotnet sln add Name/Name.csproj).

/tmp/PROJECT_NAME.json shows the following:

{
  "solution": "/home/ruttie/PROJECT_FOLDER_PATH",
  "projects": [],
  "files": []
}

Manually executing the command shown in the log output gives me proper output (with projects and files populated). Writing that output to /tmp/PROJECT_NAME.json fixes the issue, but I'm unaware if it is a permanent solution. Regardless, I assume that is not the intended way for things to work.

Related issue: https://github.com/AvaloniaUI/Avalonia/issues/19010

Ruttie2006 avatar Jun 06 '25 12:06 Ruttie2006

Our fork significantly improved the project resolution and compilation to ensure the previewer and completion work as expected. You might give it a try.

lextm avatar Aug 15 '25 10:08 lextm

Our fork significantly improved the project resolution and compilation to ensure the previewer and completion work as expected. You might give it a try.

Can confirm this resolved my issue. After clicking the first build prompt, it selected the proper Avalonia project, then asked to build again. This is in a project that refers to other C# repos, and the official extension would pick one of those projects to try and build to preview instead.

It also seems like development on this official extension is on hold or slow drastically at the moment, as the last commit was 3 months ago.

muskit avatar Aug 20 '25 00:08 muskit