Suppose I need to build a whole solution (which has multiple projects) in command line, is it possible to run a clean build for a particular projects and run an incremental build for the rest of the project?
Thanks.
To build, rebuild, or clean an entire solution Choose Build All to compile the files and components within the project that have changed since the most recent build. Choose Rebuild All to "clean" the solution and then builds all project files and components. Choose Clean All to delete any intermediate and output files.
To build a specific target of a specific project in a solution. At the command line, type MSBuild.exe <SolutionName>. sln , where <SolutionName> corresponds to the file name of the solution that contains the target that you want to execute.
On the menu bar, choose Build, and then choose either Build ProjectName or Rebuild ProjectName. Choose Build ProjectName to build only those project components that have changed since the most recent build. Choose Rebuild ProjectName to "clean" the project and then build the project files and all project components.
Clean Solution - deletes all compiled files (all dll's and exe's ). Build Solution - compiles code files (dll and exe) that have changed. Rebuild Solution - Deletes all compiled files and Compiles them again regardless of whether or not the code has changed.
Use msbuild and pass the Clean and Rebuild targets:
msbuild path\to\solution\yoursolution.sln /t:Clean;Rebuild
Or if you only want to rebuild a single project:
msbuild path\to\project\yourproject.csproj /t:Clean;Rebuild
msbuild is available in the Windows SDK or the Visual Studio Command prompt.
MSBuild.exe MultiProjectSolution.sln /t:"ProjectName:clean"
Will clean only the specified project in your solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With