'How does "Publish" in Visual Studio Work?

I am wondering how does Publish in Visual Studio work, the question is: Does the Publish in VS gets the code in the control-version to be built and published or does it get the code in local-machine to be built and published?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source