标签云

微信群

扫码加入我们

WeChat QR Code

What is the difference between Build Solution, Rebuild Solution, and Clean Solution in Visual Studio?When is the appropriate time to use each one of these?


Also see stackoverflow.com/questions/1247457/…

2019年06月26日25分20秒

Here is a nice post with details

2019年06月25日25分20秒

Is rebuild the same as clean then build?

2019年06月26日25分20秒

ColonelPanic yes

2019年06月26日25分20秒

I have personally found "Clean Solution" to be more than unhelpful. If I really want it clean, manually deleting the bin and obj folders is the way to go.Have even been caught chasing phantom "errors" - until I did that.Clean just isn't reliable.

2019年06月26日25分20秒

if artifacts made their way through other means than through build artifacts (say for example a copy from another source integrated as a msbuidltask in the cproj) then clean leaves them be.Which makes it pretty much useless, I'd even say it is dangerous as it will leave you with a false sense of cleansiness.

2019年06月26日25分20秒

The link provided shows that Rebuild is a clean followed by a build, wouldn't that be helpful to mention? I don't have the hubris to edit Mr. Skeet's post.

2019年06月25日25分20秒

Tod: Please go ahead :)

2019年06月25日25分20秒

verdana: For github etc, it's simpler to have a decent .gitignore file. But as per the answer, Clean doesn't always do a particularly thorough job in my experience.

2019年06月25日25分20秒

Thank you for explaining why Rebuild doesn't always work and I often need to clean before doing a build.

2019年06月26日25分20秒

Yes, the description and second diagram were very helpful and clear. If you could fix the "illegal" flowchart, so that Yes only goes to one place, that would help. I really can't understand what that one is trying to say, especially with "Build ALL" under "Rebuild".

2019年06月25日25分20秒

JonCoombs Yeah, I don't think the first flowchart captured exactly what he said on the video. I think the image I've inserted is what Shivprasad was aiming at.

2019年06月25日25分20秒

As I understand this, if any file has changed, the project is cleaned on a regular build, meaning it will either do nothing or it will clean and then build the project. Is this correct?

2019年06月25日25分20秒

Here is a nice post with details

2019年06月25日25分20秒

Link? I thought the idea of a DLL, aka Dynamic Link Library, was to link at runtime?

2019年06月25日25分20秒

"In practice you never need to Clean" <-- I call BS on this one.

2019年06月26日25分20秒

piers7 can you then provide a reason you would need to clean vs rebuild?

2019年06月26日25分20秒

PaulBinder You needn't look too far.

2019年06月25日25分20秒

Clean doesn't do a build.

2019年06月26日25分20秒

Jon Skeet - Learn something new every day. I would've sworn it did a rebuild. I guess my memory isn't always as reliable as I'd like.

2019年06月25日25分20秒

This had no upvotes (until now) and according to the docs (see the link in Jon's answer) this is exactly right.

2019年06月26日25分20秒

I don't think it does.I have a situation where doing a Clean Solution, followed by Build Solution works, but doing a Rebuild Solution fails.This is on a freshly created solution with 2 projects (one a dependent of the other).

2019年06月26日25分20秒

Cthutu See Shivprasad's answer for the detail that makes the difference here.Rebuild cleans and then builds each individual project at a time, whereas running Clean first cleans everything out at once, then Build builds it all at once.I've run across instances where this change in clean/build order makes the difference between compiling and not compiling, too.

2019年06月26日25分20秒

Sean Maybe it was caused by adding a project in your solution as a file reference instead of a project reference so the project build order didn't recognize it had to build a certain project before another, and the assembly didn't exist where it should have during the build?

2019年06月26日25分20秒

Rebuild cleans the projects one at a time which is not the same as Clean + Build.

2019年06月26日25分20秒

Specially in Xamarin projects I need to delete manually bin and obj folders to solve strange compilation errors

2019年06月25日25分20秒