How to remove all excluded files from a project?

Hi there, 

is there are way to find and remove all those files from a project, which are excluded from build? I use VS2013 and a C++ project.

 

Why do I want this?:

I want to move some configurations of my huge project into a separate project which only includes those selected configurations.

Currently my huge project is organised in several configs for several products, e.g.:

  • ProductA_Debug (32-/64-Bit)
  • ProductA_Release (32-/64-Bit)
  • ProductB_Debug (32-/64-Bit)
  • ProductB_Release (32-/64-Bit)

So I want ProductB (Debug + Release in 32+64 Bit) to be in a new separate project. I duplicated the project file and want now to remove all those files, which are already excluded from build of  ProductB configuration (Debug + Release in 32+64 Bit). That is, why I want to find excluded files. Unfortunately the solution map explorer of Visual Studio 2013 does not support a filter like this.

 

What I tried:

  • Project -> Context menu -> Find -> Remove unused References: "ReSharper is thinking" -> but nothing happens after "updating source files" finishes.

Thanks for your help! I appreciate.

0
4 comments
Avatar
Permanently deleted user

Hello,

Unfortunately, R++ can't help you with this. "Remove unused References" is a refactoring targeted only to managed projects, and it should be disabled for native ones (I believe this is the case at least for R# 10).

If you've got lots of files in your projects, I suppose the easiest way to split them would be to write a simple XML parser which would go through your .vcxproj files and drop the files which are excluded from build in the current configuration.

Thanks!

0

Hello Igor,

thanks for your answer. Does it mean, that the normal .vcxproj file is a native project independent of being in a solution or not? Is it possible to convert it to a managed one?

And "Remove unused References" does remove the "#include" lines of my code?

Thank you!
best regards

0
Avatar
Permanently deleted user

"Remove unused References" works only for C# and VB projects, since R# is able to analyze imports inside of them and deduce dependencies on which projects/assemblies are necessary, so unfortunately it's of no help for C++ projects.

Have a good day!

0

Ok, thank you.

Have a nice day too!

0

Please sign in to leave a comment.