rust-analyzer.vs icon indicating copy to clipboard operation
rust-analyzer.vs copied to clipboard

"Key 'program' is not set to launch configuration and /or is not a string"

Open erenturkm opened this issue 2 years ago • 7 comments

Hi,

I am using Visual Studio 2022 (Windows) Version 17.6.3 with rust-analyzer.vs v2.0.154.

I open one of the rust files, click on run or debug I get this error.

erenturkm avatar Jun 19 '23 12:06 erenturkm

thanks. which error?

please use https://www.screentogif.com/ to show the repro.

parthopdas avatar Jun 19 '23 20:06 parthopdas

VS2022Error I had a similar problem with vscode and it added the launch configuration automatically.

erenturkm avatar Jun 20 '23 06:06 erenturkm

thank you for the repro. it makes sense now.

so i'll have to disable setting anything other than cargo.toml or an example rs from the "currently selected document list". mainly because a rust project may have multiple .rs files and those are not really "startup projects".

in this case do you need to select main.rs for any specific reason? could you not select the contain toml file or the containing project from the select target drop down.

parthopdas avatar Jun 20 '23 22:06 parthopdas

VS2022Error2 cargo.toml file is not on this list, selecting Exe works or selecting cargo.toml from solution explorer, right click/debug will work but these are not the default behaviors, In c# projects we are used to start debuging from the startup project file.

Probably customizing the error message to hint on what to do, instead of a cryptic message would help a lot.

erenturkm avatar Jun 21 '23 10:06 erenturkm

customizing the error message is a good idea. it will be in the next release

parthopdas avatar Jun 27 '23 15:06 parthopdas

Hi,

I am using Visual Studio 2022 (Windows) Version 17.6.3 with rust-analyzer.vs v2.0.154.

I open one of the rust files, click on run or debug I get this error.

hey, guys, I get the right way to run rust-Project ,look at my picture image Everything is OK image

moklgydocs avatar Aug 21 '24 07:08 moklgydocs

I had the same issue. Setting the startup to be the projects Cargo.toml gets a little further, but now I get a very generic

Image

CaptainZippy avatar Feb 01 '25 12:02 CaptainZippy