diff --git a/docs/ide/reference/command-prompt-powershell.md b/docs/ide/reference/command-prompt-powershell.md index 9844a5d6fbb..38046957ff2 100644 --- a/docs/ide/reference/command-prompt-powershell.md +++ b/docs/ide/reference/command-prompt-powershell.md @@ -126,6 +126,65 @@ By default, the Developer PowerShell that launches is configured for the Visual > [!TIP] > The [execution policy](/powershell/module/microsoft.powershell.core/about/about_execution_policies) must be set in order for the cmdlet to run. +The `Launch-VsDevShell.ps1` script works by locating the `Microsoft.VisualStudio.DevShell.dll` PowerShell module in the Visual Studio installation path, loading it, and then invoking the `Enter-VsDevShell` cmdlet. Installed shortcuts, like those in the Start Menu, load the module and invoke the cmdlet directly. `Launch-VsDevShell.ps1` is the recommended way to initialize Developer PowerShell interactively or for scripting build automation. + +## Command line arguments + +### Target Architecture and Host Architecture + +For build tools -- like the C++ compiler -- that create outputs targeting specific CPU architectures the developer shells can be configured using the appropriate command line argument. The architecture of the build tool binaries can also be configured using command line arguments. This is useful when the build machine is a different architecture than the target architecture. + +> [!TIP] +> Beginning with Visual Studio 2022, `msbuild` will default to a 64-bit msbuild.exe binary, regardless of the Host Architecture. + +|Shell|Argument| +|--|--| +|Developer Command Prompt|-arch=<Target Architecture>| +|Developer Command Prompt|-host_arch=<Host Architecture>| +|Developer PowerShell|-Arch <Target Architecture>| +|Developer PowerShell|-HostArch <Host Architecture>| + +Developer PowerShell arguments -Arch and -HostArch are only available beginning with Visual Studio 2022 Update 1. + +The following is a list of which architectures are supported, and whether they can be used for the Target Architecture or Host Architecture arguments. + +|Architecture|Target Architecture|Host Architecture| +|--|--|--| +|x86|Default|Default| +|amd64|Yes|Yes| +|arm|Yes|No| +|arm64|Yes|No| + +> [!TIP] +> If only Target Architecure is set, the shells will attempt to make the Host Architecture match. This can result in errors when setting only the Target Architecture to a value not also supported by Host Architecture. + +#### Examples + +Start Developer Command Prompt for Visual Studio 2019 Community Edition on a 64-bit machine, creating build outputs that target 64-bit: +```cmd +"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 +``` + +Start Developer Command Prompt for Visual Studio 2019 Community Edition on a 64-bit machine, creating build outputs that target arm: +```cmd +"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=arm -host_arch=amd64 +``` + +Start Developer PowerShell for Visual Studio 2022 Update 1 Community Edition on 64-bit machine, creating build outputs that target arm64: +```powershell +& 'C:\Program Files (x86)\Microsoft Visual Studio\2022\Community\Common7\Tools\Launch-VsDevShell.ps1' -Arch arm64 -HostArch amd64 +``` + +### SkipAutomaticLocation + +For Developer PowerShell, the starting directory of the shell is the Visual Studio Project Location. This will override any other paths, such as working directory. This behavior can be turned off using the +command line argument `-SkipAutomaticLocation`. This is useful if, for example, you want the shell to stay in the current directory after initialization. + +The Project Location can be adjusted in Tools -> Options -> Projects & Solutions -> Project Location. + +> [!TIP] +> The command line arguments `-Arch`, `-HostArch`, and `-SkipAutomaticLocation` are supported by both the `Launch-VsDevShell.ps1` script and the `Enter-VsDevShell` cmdlet. + ## See also - [Windows Terminal](/windows/terminal/) diff --git a/docs/ide/whats-new-visual-studio-2022.md b/docs/ide/whats-new-visual-studio-2022.md index 7b60c91ae23..9889eb621a5 100644 --- a/docs/ide/whats-new-visual-studio-2022.md +++ b/docs/ide/whats-new-visual-studio-2022.md @@ -2,7 +2,7 @@ title: "What's new in Visual Studio 2022" titleSuffix: "" description: "Learn about the new features in Visual Studio 2022." -ms.date: 01/26/2022 +ms.date: 02/15/2022 helpviewer_keywords: - "Visual Studio, what's new" - "what's new [Visual Studio]" @@ -17,7 +17,7 @@ ms.workload: --- # What's new in Visual Studio 2022 -**Updated for the 17.0 GA (General Availability) release.** See [full release notes](/visualstudio/releases/2022/release-notes) | View [product roadmap](/visualstudio/productinfo/vs-roadmap/) +**Updated for the 17.1 release.** See [full release notes](/visualstudio/releases/2022/release-notes) | View [product roadmap](/visualstudio/productinfo/vs-roadmap/) >[!div class="button"] >[Download Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) @@ -25,7 +25,7 @@ ms.workload: With [Visual Studio 2022](https://visualstudio.microsoft.com/vs/), you'll always get the best-in-class tools and services available for any developer, any app, and any platform. Whether you're using Visual Studio for the first time or you've been using it for years, there's a lot to like in our newest version! > [!TIP] -> Check out the [**Visual Studio 2022 launch event**](https://www.youtube.com/watch?v=f8jXO946eDw) on our [YouTube channel](https://www.youtube.com/visualstudio). You can also catch it on our [Twitch channel](https://www.twitch.tv/visualstudio), too. +> Check out the [**Visual Studio 2022 GA launch event**](https://www.youtube.com/watch?v=f8jXO946eDw) on our [YouTube channel](https://www.youtube.com/visualstudio). You can also catch it on our [Twitch channel](https://www.twitch.tv/visualstudio), too. ## Performance improvements diff --git a/docs/version-control/git-browse-repository.md b/docs/version-control/git-browse-repository.md index c0b853f5a73..29ca675ab73 100644 --- a/docs/version-control/git-browse-repository.md +++ b/docs/version-control/git-browse-repository.md @@ -9,10 +9,9 @@ ms.manager: jmartens ms.prod: visual-studio-windows ms.technology: vs-ide-general --- +# Browse Git repositories and compare branches in Visual Studio -# Browse Git repos & compare commits in Visual Studio - -The **Git Changes** window provides a seamless way to interact with Git while coding without having to switch away from your code. But there are times when it makes more sense to focus on your Git repository. For example, you might need to get a good picture of what your team has been working on or maybe compare two commits to investigate a bug. +The **Git Changes** window provides a seamless way to interact with Git while coding without having to switch away from your code. But there are times when it makes more sense to focus on your Git repository. For example, you might need to get a good picture of what your team has been working on or maybe [compare two commits](#compare-commits) to investigate a bug. You can work remotely with the Git provider of your choice, such as GitHub or Azure DevOps. @@ -43,6 +42,8 @@ You can browse though any local or remote branch without having to switch your b > >:::image type="content" source="media/vs-2022/git-repository-commit-details-full-screen.png" alt-text="Screenshot of full-screen commit details with diff configurations." lightbox="media/vs-2022/git-repository-commit-details-full-screen.png"::: + + ## Compare commits To compare any two commits in your branch, use the **Ctrl** key to select the two commits that you want to compare. Then right-click one of them and select **Compare Commits**. @@ -63,8 +64,41 @@ In Visual Studio, you can use the **Git Graph** pane in the **Git Repository** w > [!NOTE] > The equivalent command for this action is `git branch []`. +## Compare branches +Comparing branches provides an overview of differences between two branches which can be very helpful before creating a pull request, merging, or even deleting a branch. + +:::image type="content" source="media/vs-2022/git-compare-branches-illustration.png" alt-text="Compare branches illustration" lightbox="media/vs-2022/git-compare-branches-illustration.png"::: + +To compare your currently checked out branch with other branches using Visual Studio, you can utilize the branch picker hosted in the status bar and the Git changes tool window to choose any local or remote branch to compare with. Right click the branch you are targeting and select **Compare with Current Branch**. Alternatively, you can utilize the branch list on the Git Repository window to access the same command. + +:::image type="content" source="media/vs-2022/git-compare-branches-entrypoints.gif" alt-text="Compare branches entrypoints"::: + +Selecting **Compare with Current Branch** opens the compare branches experience where you can navigate the **Changes** list and select the file that you would like to compare. + +:::image type="content" source="media/vs-2022/git-compare-branches.png" alt-text="Compare branches diff view" lightbox="media/vs-2022/git-compare-branches.png"::: + > [!TIP] -> To learn how the [Preview](/visualstudio/releases/2022/release-notes-preview) version of Visual Studio 2022 makes it easy to checkout commits, see the "Checkout commits" section of the [Introducing new Git features to Visual Studio 2022](https://devblogs.microsoft.com/visualstudio/introducing-new-git-features-to-visual-studio-2022/#checkout-commits) blog post. +> If you prefer an inline diff, you can use the diff configuration options gear and switch to an inline diff view. +> :::image type="content" source="media/vs-2022/git-diff-configuration-options.png" alt-text="Diff configuration options"::: + +## Checkout commits +Checking out a commit can be beneficial in multiple ways. For example, it allows you to go back to a previous point in your repository’s history where you can run or test your code. It can also be helpful if you would like to review code from a remote branch (a colleague’s branch, for example). That way you don’t need to create a local branch if you are not planning on contributing to it. In this case, you can just checkout the tip of the remote branch that you would like to review. + +:::image type="content" source="media/vs-2022/git-checkout-commit-illustration.png" alt-text="Checkout commit illustration"::: + +To checkout a previous commit in Visual Studio, open the **Git Repository** window, right click on the commit you would like to go back to and select **checkout (–detach)**. Visual Studio shows a confirmation dialog explaining that by checking out a commit you will be in a detached HEAD state. Meaning that the HEAD of your repository is going to point directly to a commit instead of a branch. + +:::image type="content" source="media/vs-2022/git-checkout-commit-entrypoints.gif" alt-text="Checkout commit entry points"::: + +Now that you are in a detached head state, feel free to run and test your code or even explore and commit changes. When you are done exploring and want to go back to your branch, you can choose to discard your changes by checking out an existing branch or choose to keep your changes by **[creating a new branch](git-create-branch.md)** first. + +> [!IMPORTANT] +> Commits created in a detached head state are not associated with any branch and may be garbage collected by Git after you checkout a branch. That is why to keep your changes, it is recommended to create a new branch before checking out a branch. For example, commits C5 and C6 will be garbage collected if we check out Main without creating a new branch. +> :::image type="content" source="media/vs-2022/git-detached-head-commits-illustration.png" alt-text="Detached head commits illustration"::: +> To learn more about the detached head state view the following Git documentation: [Detached Head](https://git-scm.com/docs/git-checkout#_detached_head) + +Checking out the tip of a remote branch can be helpful if you would like to quickly review a pull request and evaluate the latest updates. To do that in Visual Studio, first make sure to fetch and get the latest updates from your remote repository. Then right click on the remote branch you would like to review and select **Checkout Tip Commit**. +:::image type="content" source="media/vs-2022/git-checkout-tip-commit.png" alt-text="Checkout tip commit" lightbox="media/vs-2022/git-checkout-tip-commit.png"::: ## Next steps diff --git a/docs/version-control/media/vs-2022/git-checkout-commit-entrypoints.gif b/docs/version-control/media/vs-2022/git-checkout-commit-entrypoints.gif new file mode 100644 index 00000000000..da056c9491e Binary files /dev/null and b/docs/version-control/media/vs-2022/git-checkout-commit-entrypoints.gif differ diff --git a/docs/version-control/media/vs-2022/git-checkout-commit-entrypoints.png b/docs/version-control/media/vs-2022/git-checkout-commit-entrypoints.png new file mode 100644 index 00000000000..d8773bc25eb Binary files /dev/null and b/docs/version-control/media/vs-2022/git-checkout-commit-entrypoints.png differ diff --git a/docs/version-control/media/vs-2022/git-checkout-commit-illustration.png b/docs/version-control/media/vs-2022/git-checkout-commit-illustration.png new file mode 100644 index 00000000000..06dff2112d7 Binary files /dev/null and b/docs/version-control/media/vs-2022/git-checkout-commit-illustration.png differ diff --git a/docs/version-control/media/vs-2022/git-checkout-tip-commit.png b/docs/version-control/media/vs-2022/git-checkout-tip-commit.png new file mode 100644 index 00000000000..931baf663c8 Binary files /dev/null and b/docs/version-control/media/vs-2022/git-checkout-tip-commit.png differ diff --git a/docs/version-control/media/vs-2022/git-compare-branches-entrypoints.gif b/docs/version-control/media/vs-2022/git-compare-branches-entrypoints.gif new file mode 100644 index 00000000000..1cab1b6a087 Binary files /dev/null and b/docs/version-control/media/vs-2022/git-compare-branches-entrypoints.gif differ diff --git a/docs/version-control/media/vs-2022/git-compare-branches-illustration.png b/docs/version-control/media/vs-2022/git-compare-branches-illustration.png new file mode 100644 index 00000000000..ff1ca2342ca Binary files /dev/null and b/docs/version-control/media/vs-2022/git-compare-branches-illustration.png differ diff --git a/docs/version-control/media/vs-2022/git-compare-branches.png b/docs/version-control/media/vs-2022/git-compare-branches.png new file mode 100644 index 00000000000..1b6ab0bc8b9 Binary files /dev/null and b/docs/version-control/media/vs-2022/git-compare-branches.png differ diff --git a/docs/version-control/media/vs-2022/git-detached-head-commits-illustration.png b/docs/version-control/media/vs-2022/git-detached-head-commits-illustration.png new file mode 100644 index 00000000000..3b246b21769 Binary files /dev/null and b/docs/version-control/media/vs-2022/git-detached-head-commits-illustration.png differ diff --git a/docs/version-control/media/vs-2022/git-diff-configuration-options.png b/docs/version-control/media/vs-2022/git-diff-configuration-options.png new file mode 100644 index 00000000000..bba881fb7f8 Binary files /dev/null and b/docs/version-control/media/vs-2022/git-diff-configuration-options.png differ