kitamstudios / rust-analyzer.vs

Rust language support for Visual Studio 2022
https://marketplace.visualstudio.com/items?itemName=kitamstudios.RustAnalyzer
Other
138 stars 10 forks source link

Incremental build under debug configuration ? #44

Open mediabuff opened 5 months ago

mediabuff commented 5 months ago

Does Incremental build under debug configuration work ? Every time I change a single source file, I have to a 'clean' and 'build''. Otherwise I get source out of sync error

image

parthopdas commented 4 months ago

I have seen this issue (as I use the extension on projects like burn). However I am yet to notice a pattern. For sure it isn't that an incremental build does not work.

Any observations / suggestions will be helpful.

jerrywrice commented 2 months ago

I don't know how you created your project, or what went wrong, but the following might be useful information. Note that I'm using VS2022 Professional for AMDx64 architecture, with the VS2022 C/C++ MSBuild components installed. I obviously have the latest standard rust compiler and tools installed. I've also installed 'rust-analyzer.vs' extension V2.0.187 in my VS2022. I opened my rust project folder that was created with 'cargo'. Upon opening my rust project folder with VS2022 the first time, rather than generating an 'incremental' configuration that this issue mentions, it instead generated a 'bin' configuration. This 'bin' configuration selection (a debug build), specifically performs an incremental build (builds only the project files which have changed since the last successful build). In my case, my Windows rust application project folder (name) is 'demo-gtk-app', so the build configuration is shown as '[bin: ] demo-gtk-app.exe'. My suggestion is (after backing up your current project folder/files), re-generate your project folder from scratch using either 'cargo new ' or another means you're familiar with. Recreate a standard cargo project folder. and tweak its 'cargo.toml' file so that it allows you to successfully build your project (with 'cargo build ...'). After successfully building and running your application in a terminal window with cargo, open your Visual Studio 20xx, and execute an 'Open Local Folder/File' to select your cargo project's top-level folder. Upon opening the first time, the 'rust-analyzer.vs' extension should automatically recognize that you've selected a rust project folder, and will perform some additional setup/configuration. Next confirm you have a '[bin: ] ' build configuration defined. This method should also translate to a library project as well - although I haven't done so with Visual Studio yet, so the build configuration might be named something other than 'bin' for a library.