Skip to content

Commit 40c306c

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/visualstudio-docs-pr (branch live)
2 parents d8885a0 + e8f6e9c commit 40c306c

10 files changed

Lines changed: 87 additions & 7 deletions

docs/python/includes/project-from-existing.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,49 @@ Follow these steps to create a project from existing files.
1717

1818
1. In the **Create New Project from Existing Python Code** wizard, set the **Folder path** to your existing code, set a **Filter** for file types, and specify any **Search paths** that your project requires, then select **Next**. If you don't know the search paths, leave the field blank.
1919

20+
::: moniker range="visualstudio"
21+
22+
:::image type="content" source="../media/visualstudio/projects-from-existing-1.png" alt-text="Screenshot of a New Project creation from Existing Code, including choosing the folder path, file type filters, and search paths in Visual Studio." lightbox="../media/visualstudio/projects-from-existing-1.png":::
23+
24+
::: moniker-end
25+
26+
::: moniker range="vs-2022"
27+
2028
:::image type="content" source="../media/projects-from-existing-1.png" alt-text="Screenshot of a New Project creation from Existing Code, including choosing the folder path, file type filters, and search paths." lightbox="../media/projects-from-existing-1.png":::
2129

30+
::: moniker-end
31+
2232
1. On the next page, select the **Startup file** for your project. Visual Studio selects the default global Python interpreter and version. You can change the environment by using the dropdown menu. When you're ready, select **Next**.
2333

2434
> [!NOTE]
2535
> The dialog shows only files in the root folder. If the file you want is in a subfolder, leave the startup file blank. You can set the startup file in **Solution Explorer**, as described in a later step.
2636
37+
::: moniker range="visualstudio"
38+
39+
:::image type="content" source="../media/visualstudio/projects-from-existing-2.png" alt-text="Screenshot of New Project Creation from Existing Code window, including choosing the startup file and Python environment in Visual Studio." lightbox="../media/visualstudio/projects-from-existing-2.png":::
40+
41+
::: moniker-end
42+
43+
::: moniker range="vs-2022"
44+
2745
:::image type="content" source="../media/projects-from-existing-2.png" alt-text="Screenshot of New Project Creation from Existing Code window, including choosing the startup file and Python environment." lightbox="../media/projects-from-existing-2.png":::
2846

47+
::: moniker-end
48+
2949
1. Select the location to store the project file (a _.pyproj_ file on disk). If applicable, you can also include autodetection of virtual environments and customize the project for different web frameworks. If you're unsure of these options, leave the fields set to the defaults.
3050

51+
::: moniker range="visualstudio"
52+
53+
:::image type="content" source="../media/visualstudio/projects-from-existing-3.png" alt-text="Screenshot of a New Project creation from Existing Code window, including the location for the project file and other optional settings in Visual Studio." lightbox="../media/visualstudio/projects-from-existing-3.png":::
54+
55+
::: moniker-end
56+
57+
::: moniker range="vs-2022"
58+
3159
:::image type="content" source="../media/projects-from-existing-3.png" alt-text="Screenshot of a New Project creation from Existing Code window, including the location for the project file and other optional settings." lightbox="../media/projects-from-existing-3.png" :::
3260

61+
::: moniker-end
62+
3363
1. Select **Finish**.
3464

3565
Visual Studio creates the project and opens it in **Solution Explorer**. If you want to move the _.pyproj_ file to a different location, select the file in **Solution Explorer**, and then select **File** > **Save As** on the toolbar. This action updates file references in the project, but it doesn't move any code files.

docs/python/managing-python-projects-in-visual-studio.md

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Manage Python application projects
2+
title: Manage Python Application Projects
33
description: Explore how projects in Visual Studio manage dependencies between files and the complexity of relationships in an application.
4-
ms.date: 04/18/2024
4+
ms.date: 06/01/2026
55
ms.topic: how-to
66
author: Devdiv-VR
77
ms.author: vedhar
@@ -15,7 +15,17 @@ ms.subservice: python
1515

1616
Python applications are typically defined by using only folders and files. This structure can become complex as applications grow and perhaps involve autogenerated files, JavaScript for web applications, and so on. A [Visual Studio project](../ide/solutions-and-projects-in-visual-studio.md#projects) can help you manage the complexity. The project (a `.pyproj` file) identifies all the source and content files associated with your project. It contains build information for each file, maintains the information to integrate with source-control systems, and helps you organize your application into logical components.
1717

18-
:::image type="content" source="media/projects-solution-explorer.png" alt-text="Screenshot that shows a Python project open in Solution Explorer in Visual Studio." lightbox="media/projects-solution-explorer.png":::
18+
::: moniker range="visualstudio"
19+
20+
:::image type="content" source="media/visualstudio/projects-solution-explorer.png" alt-text="Screenshot that shows a Python project open in Solution Explorer in Visual Studio." lightbox="media/visualstudio/projects-solution-explorer.png":::
21+
22+
::: moniker-end
23+
24+
::: moniker range="vs-2022"
25+
26+
:::image type="content" source="media/projects-solution-explorer.png" alt-text="Screenshot that shows a Python project open in Solution Explorer." lightbox="media/projects-solution-explorer.png":::
27+
28+
::: moniker-end
1929

2030
Projects are always managed within a [Visual Studio solution](../ide/solutions-and-projects-in-visual-studio.md#solutions). A solution can contain any number of projects that might reference one another, such as a Python project that references a C++ project that implements an extension module. With this relationship, Visual Studio automatically builds the C++ project (if necessary) when you start debugging the Python project. For more information, see [Solutions and projects in Visual Studio](../ide/solutions-and-projects-in-visual-studio.md).
2131

@@ -53,17 +63,47 @@ If you remove the selected startup file from a project and don't select an alter
5363
5464
A new project is always associated with the default global Python environment. To associate the project with a different environment (including virtual environments), right-click the **Python Environments** node in the project. Select **Add Environment** and then select the environments you want. You can also use the environments drop-down control on the toolbar to select an environment or add another environment to the project.
5565

56-
:::image type="content" source="media/vs-2022/environments-toolbar-2022.png" alt-text="Screenshot that shows the Add Environment command on the Python toolbar in Visual Studio.":::
66+
::: moniker range="visualstudio"
67+
68+
:::image type="content" source="media/visualstudio/environments-toolbar.png" alt-text="Screenshot that shows the Add Environment command in Visual Studio.":::
69+
70+
::: moniker-end
71+
72+
::: moniker range="vs-2022"
73+
74+
:::image type="content" source="media/vs-2022/environments-toolbar-2022.png" alt-text="Screenshot that shows the Add Environment command on the Python toolbar.":::
75+
76+
::: moniker-end
5777

5878
To change the active environment, right-click the desired environment in **Solution Explorer** and select **Activate Environment** as shown in the following image. For more information, see [Select an environment for a project](selecting-a-python-environment-for-a-project.md).
5979

60-
:::image type="content" source="media/vs-2022/projects-activate-environment-2022.png" alt-text="Screenshot that shows how to activate an environment for a Python project in Visual Studio." lightbox="media/vs-2022/projects-activate-environment-2022.png":::
80+
::: moniker range="visualstudio"
81+
82+
:::image type="content" source="media/visualstudio/projects-activate-environment.png" alt-text="Screenshot that shows how to activate an environment for a Python project in Visual Studio." lightbox="media/visualstudio/projects-activate-environment.png":::
83+
84+
::: moniker-end
85+
86+
::: moniker range="vs-2022"
87+
88+
:::image type="content" source="media/vs-2022/projects-activate-environment-2022.png" alt-text="Screenshot that shows how to activate an environment for a Python project." lightbox="media/vs-2022/projects-activate-environment-2022.png":::
89+
90+
::: moniker-end
6191

6292
## Project templates
6393

6494
Visual Studio gives you many ways to set up a Python project, either from scratch or from existing code. To use a template, select **File** > **New** > **Project** or right-click the solution in **Solution Explorer** and select **Add** > **New Project**. In the **new project** dialog, you can see Python-specific templates by searching on *Python* or by selecting the **Language** > **Python** node:
6595

66-
:::image type="content" source="media/projects-new-project-dialog.png" alt-text="Screenshot that shows the new project dialog with available Python templates in Visual Studio." lightbox="media/projects-new-project-dialog.png":::
96+
::: moniker range="visualstudio"
97+
98+
:::image type="content" source="media/visualstudio/projects-new-project-dialog.png" alt-text="Screenshot that shows the new project dialog with available Python templates in Visual Studio." lightbox="media/visualstudio/projects-new-project-dialog.png":::
99+
100+
::: moniker-end
101+
102+
::: moniker range="vs-2022"
103+
104+
:::image type="content" source="media/projects-new-project-dialog.png" alt-text="Screenshot that shows the new project dialog with available Python templates." lightbox="media/projects-new-project-dialog.png":::
105+
106+
::: moniker-end
67107

68108
::: moniker range=">=vs-2022"
69109

@@ -120,7 +160,17 @@ Linked files can't be renamed.
120160

121161
Visual Studio projects support adding references to projects and extensions, which appear under the **References** node in **Solution Explorer**:
122162

123-
:::image type="content" source="media/projects-extension-references.png" alt-text="Screenshot that shows how to Add an extension reference in Python projects in Visual Studio." lightbox="media/projects-extension-references.png":::
163+
::: moniker range="visualstudio"
164+
165+
:::image type="content" source="media/visualstudio/projects-extension-references.png" alt-text="Screenshot that shows how to Add an extension reference in Python projects in Visual Studio." lightbox="media/visualstudio/projects-extension-references.png":::
166+
167+
::: moniker-end
168+
169+
::: moniker range="vs-2022"
170+
171+
:::image type="content" source="media/projects-extension-references.png" alt-text="Screenshot that shows how to Add an extension reference in Python projects." lightbox="media/projects-extension-references.png":::
172+
173+
::: moniker-end
124174

125175
Extension references typically indicate dependencies between projects and are used to provide IntelliSense at design time or linking at compile time. Python projects use references in a similar fashion, but due to the dynamic nature of Python they're primarily used at design time to provide improved IntelliSense. They can also be used for deployment to Microsoft Azure to install other dependencies.
126176

17.1 KB
Loading
16.7 KB
Loading
16.3 KB
Loading
21.9 KB
Loading
23.5 KB
Loading
30.5 KB
Loading
55.8 KB
Loading
11.9 KB
Loading

0 commit comments

Comments
 (0)