Visual Studio "Clean & Rebuild" in one button? - visual-studio

My solution i'm working on it's has some specialy. And sometime I need to Clean solution and after that Rebuild solution, if not the web application can not access. That why I made a bat file for that work and bind the bat file to a button in Visual Studio toolbar.
But with that way, visual studio just run the bat file, so it clean and rebuild just one solution I'm defined before in the bat file. What I want is a button which can clean and rebuild on solution OPENING, is made a combo of Clean and Rebuild commands of visual studio to just one button.
Is there a way for me?
I'm using Visual Studio 2013.

As #Blorgbeard said,
What is Rebuild Solution?
Rebuild solution will clean and then build the solution from scratch, ignoring anything it’s done before. What it does is deletes all the assemblies, exe’s and referred files to compile again.
What is Clean Solution?
Clean Solution will delete all compiled files (i.e., EXE’s and DLL’s) from the bin/obj directory.
Rebuild means compile and link all source files regardless of whether they changed or not. Build is the normal thing to do and is faster. Sometimes the versions of project target components can get out of sync and rebuild is necessary to make the build successful. In practice, you never need to Clean.

Related

Visual Studio 2015 - Minimum Rebuild when Start Debug

My project has 15 projects and 1 solution file
If my source code has not been modified, Visual Studio prompts me if I want to build the 15 project files?
There is a box to say not to display it again, I'm not sure why Visual Studio thinks the code is out of date?
Thanks for the feedback
If my source code has not been modified, Visual Studio prompts me if I
want to build the 15 project files?
No. If your code has not been changed, it will always show up-to-date, not build. VS has the feature of incremental build.
Note: you should click Build button rather than Rebuild. Rebuild will execute clean and then build, so it will always execute the whole build process.
Once you do not modify the resource files, MSBuild will detect that the project has not changed and does not need to be built again, turns out to up-to-date.
Therefore, under normal circumstances, MSBuild will not build again without changing the project.
There is a box to say not to display it again, I'm not sure why Visual
Studio thinks the code is out of date?
In fact, it should not happen.
If you have not made any changes to the project but the build still displays out-of-date, you have to check the diagnostic build log and find it out.
Enter Tools-->Options-->Projects and Solutions-->Build and Run--> set MSBuild project build output verbosity to Diagnostic . And then build your project to find the cause out.
Maybe you have set Copy To Output Directories of some files to Copy always or you have lost the files for inputs and ouputs, .... so on.

Visual Studio menu is missing the "Clean" option?

I have a metadata file error that I am attempting to fix. One of the solutions that I want to attempt is to individually clean and rebuild the projects. I see two solutions that should work:
Right click on the project individually and select clean.
select the project, select build from the menu, select clean 'projectname'
The problem that I have is that the right click context menu is not showing clean. It shows build and rebuild but not clean.
In the build menu, it only shows options to clean / build the entire solution, no matter what I currently have selected.
I have done the rebuild on each project individually, but the Metadata error is still there.
What can I do to get the options to clean an individual project?
You can always do a "manual" clean of a project by deleting both bin and obj -folders from the projects folder. Sometimes the Clean-feature in Visual Studio doens't do decent enough job so I do this:
Note: Sometimes Visual Studio is using files from these folders so you can't have the project open and delete. Close Visual Studio and delete the folders by hand from the folder and reopen Visual Studio.

How to execute a command after every build in Visual Studio 2012?

I want to execute a postbuild command after every build, no matter what project in my solution has changed.
To accomplish this in Visual Studio 2010, I made one empty project depend on every other project, so it always got built, executing its postbuild command. However, Visual Studio 2012 (RC) appears to recognize that the dependency is not real, and will not build this empty project automatically.
I do not see any way to specify a solution postbuild script in solution settings. How can I accomplish this?
I have solved this issue by making my post-build script also delete the output (bin**) of this "empty" project, forcing a rebuild of this project every time. It appears to work satisfactorily so far.
This works (for details see original post):
you may need to change security settings (at your own risk) e.g.: https://stackoverflow.com/a/60284384/2705777

Visual Studio 2010 F5 Debugging C++ is not Rebuilding

I have a Visual Studio 2010 Ultimate C++ project (not managed or .NET). When I press F5 (i.e., start debugging), I want it to save all the files, rebuild those that changed, link the whole thing, and then run. Instead, it appears to use the last build. Thus, when I try to step into a function or something, I get the following error:
Based on my research, I have verified these options, the first three of which are in the Options dialog (can be reached under "Debug->Options and Settings"):
"Projects and Solutions->Build and Run->Only build startup projects and dependencies on Run" is checked. Some research indicated that it should be unchecked, but in my case I actually do only want it to rebuild the startup project. For what it's worth, I've tried unchecking it, with no effect.
"Projects and Solutions->Build and Run->On Run, when projects are out of date:" is set to "Always build".
"Debugging->Edit and Continue->Enable Edit and Continue" is checked, though it's greyed out.
In the Configuration Manager ("Build->Configuration Manager"), all solution configurations and platforms have their "Build" checkbox checked.
I have also tried deleting all Debug and Release directories as well as the .sdf and ipch directory.
For completeness, I suppose I should mention that I'm using precompiled headers, though I kinda doubt it matters.
[EDIT: I should note that it only seems to be one file (a .h file) that's doing it. I tried renaming it and recompiling, and also removing it from the solution and adding it back in, but it didn't work. ]
I was able to bring my solution back into the right state after deleting all .suo and .csproj.user files. Answer led to this solution. Hope this saves someone time.
I fell into this state after installing Ultimate over Professional and running profiling tools.
Once I had similar problem with my C# project and I think I have tried every possible suggestion available on internet but none worked and then this is what I have done:
Created an empty Project
Added startup function to verify that it does not show any error
Imported all my source code manually one by one
So, Yes, it was the solution. You already have done a lot so I would say you can get lucky by trying here and there however having a new project and importing your individual source file would be faster.
Another solution could be that switching the platform. I noticed that when I when to project properties, the new project I had just created had a platform of 'win32' and my other projects in the same solution had it set at x64. After I switched my project to x64, everything worked just fine. This worked for my interop(C,C+, C#) project and hopefully works for other projects as well.
I have successfully resolved it, try the following:
remove all temporary and intellisense files
remove all project from solution and then add them back(most important)
check projects 'Frameworks and References' to ensure they are valid

what can cause Visual Studio to rebuild my entire solution all the time?

I have a largeish solution in Visual Studio 2008 (around 30 projects, all C# and Script#), including some test projects.
When I start the application or run my tests, way to often Visual Studio rebuilds everything rather than just the changed parts and their dependencies.
If I don't change anything at all, it will not rebuild, but as soon as I change any file in any project, everything in the entire solution will be rebuilt, even the 90% of projects which were not affected at all.
Does anyone have an idea of what the problem can be, or provide me a hint of where I can start troubleshooting it?
Edit: To clarify, all projects in the solution are rebuilt, even those which are not directly or indirectly dependent on the project that has actually been modified. Even those which the modified project depends on, so it can't be a simple project reference issue.
The build sequence is determined by the project references (dependencies).
To avoid to build the projects depending on the project you've edited, you can use Build Current under the menu Build.
I setup CTL+B as shortcut to Build Current which saved me a lot of time than F6. Everytime I just use CTL+B after I save a file.
Hopefully this will help.
You can use the configuration manager to set up a specific config for your sln that will only build the projects you specify. You can find it under Build->Configuration Manager

Resources