how to sync project with filesystem?
I manually removed some files and added some other files into a folder of my Rider project. I ended up with missing files showing with warnings in solution tab, and new files not showing up. How to change this behavior of Rider so it will always be in sync with the filesystem? Or how to just sync the folder? I use multiple projects over a single directory, so its very annoying when changed made by one project aren't visible in another.
Please sign in to leave a comment.
Hello,
Thank you for contacting Rider support.
I suppose your project targets .Net Framework (not .Net 5+), is it? If this is the case, your project uses legacy “Non-SDK” style project file format. The problematic rule is that every needed .cs (and other) files that belong to project should be referenced in .csproj file.
When you delete project files outside IDE, same as when you put new files to project folder outside IDE, you make the content of the .csproj file invalid. So that the files referenced in .csproj file are literally missing. The files that you added to a folder are not referenced in .csproj file. There is a demonstration of that issue on a single screenshot:
The AddedExternally.cs file exists in folder, but not referenced in .csproj file. To solve this, activate the “Show all files” next to “Solution” project explorer. Then right-click on files that are marked as “no index”;
The CreatedInRiderAndDeletedOutside.cs file doesn't exist, but referenced in .csproj file. To solve this, right-click on file in explorer and select “exclude”.
Unfortunately, as soon as you are using legacy project file format, it is not possible to automatically sync changes you make to project structure outside Rider. You might want to use Rider UI to add/remove files from project, so that Rider would handle your actions properly. There are two basic actions for your case:
If that doesn't help or you have any other questions or difficulties, please let me know.
Have a nice day!
thank you for the reply, but how do I use non-legacy project file format? how to migrate?
Would you mind sharing your project with me, so that I can advise? If it is possible, please archive the project, upload it to the Upload Service (https://uploads.jetbrains.com/) and let me know the Upload ID.
If you can't share the project, you might find instructions over the internet. Here is an example I found: https://netexplorer.hashnode.dev/migrating-to-an-sdk-style-project
Have a nice day!