I have several project configurations and I switch between them constantly. However, every time I switch, I have to manually do a rebuild before running. How do I force it to rebuild automatically?
How do I force a rebuild when the project configuration changes? [duplicate]
Asked Answered
@CodyGray - FYI, That linked question is somewhat different. There are situations where changing configuration does not cause Visual Studio to recognize that it needs to rebuild. VS does fine in the "simple" case - switching between Release and Debug, but in my experience, VS isn't always aware when switching between configurations that include different compile-time flags [e.g. to exclude some proprietary lines of managed code that should not exist in a binary sent off-site]. So Clean or Rebuild becomes necessary. (Or worst case, delete bin and obj folders.) –
Deuteranope
@Deuteranope The two questions have exactly the same answer, and these answers had stood for nearly 10 years without another answer being offered at the time I marked it as a duplicate. I'm happy to re-open this one if you want to post a different answer, but based on your comment, it looks like you're just pointing out a possible bug in Visual Studio rather than providing an answer. –
Verruca
From the Tools Menu
Select Options
Select Projects and Solutions
Select Build and Run
In the combo box below the text that says "On Run, when projects are out of date"
Make sure that you have selected "Always build"
This will rebuild all projects on each run even when configuration did not change. –
Lawabiding
Also, try unchecking the "Only build startup projects..." option. –
Feliks
@Lawabiding - actually, as the option says, it builds [always] when projects are out of date. If you find that checking this causes rebuild every time, that is a different situation (one could consider it a VS "bug"); google for threads that describe why this might be, and how to find the cause [header file that no longer exists; copy always of resource file in such a way that it appears resource dictionary needs rebuilding; circular reference between projects; ....]. –
Deuteranope
I have a project containing only content files, which should be copied into output folder during building the project. All files have following properties: BuildAction=Content, CopyToOutputDirectory=CopyAlways. However, I must rebuild it by myself each time after start options change (command line arguments). All of the above does not work for me. Seems it works for the code changes only. –
Logjam
© 2022 - 2024 — McMap. All rights reserved.