Skip to content

Repo sync for protected branch #10359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 59 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
c1ff121
freshness pass
v-albemi Aug 12, 2024
596d57b
edits
v-albemi Aug 12, 2024
ab6b682
edits
v-albemi Aug 12, 2024
e6ead4f
edits
v-albemi Aug 12, 2024
8904d0a
edits
v-albemi Aug 12, 2024
2ade6fc
edits
v-albemi Aug 12, 2024
9184f6e
edits
v-albemi Aug 13, 2024
6d28cc7
new pr
v-albemi Aug 13, 2024
665103c
updates
v-albemi Aug 13, 2024
58ed2ce
updates
v-albemi Aug 13, 2024
bbedeb3
updates
v-albemi Aug 13, 2024
da86b71
updates
v-albemi Aug 13, 2024
9111c94
new pr
v-albemi Aug 13, 2024
c1eeedf
updates
v-albemi Aug 14, 2024
8616b96
updates
v-albemi Aug 14, 2024
cc7f623
updates
v-albemi Aug 14, 2024
66a43e9
updates
v-albemi Aug 14, 2024
e1c58ef
updates
v-albemi Aug 14, 2024
26098b9
updates
v-albemi Aug 14, 2024
8acea96
updates
v-albemi Aug 14, 2024
857c403
new pr
v-albemi Aug 14, 2024
891c1e4
updates
v-albemi Aug 14, 2024
27a3f3f
updates
v-albemi Aug 14, 2024
6edbe58
updates
v-albemi Aug 14, 2024
ab9119b
updates
v-albemi Aug 14, 2024
425b867
updates
v-albemi Aug 14, 2024
093b491
updates
v-albemi Aug 14, 2024
2ba0459
updates
v-albemi Aug 14, 2024
dd5247d
Update for VS 2022
ghogen Aug 15, 2024
7ccbce7
updates
v-albemi Aug 15, 2024
7f3b060
fix link
ghogen Aug 15, 2024
5ea1cb8
updates
v-albemi Aug 15, 2024
7addbe4
updates
v-albemi Aug 15, 2024
f93bc17
updates
v-albemi Aug 15, 2024
c6f0bd4
fix link redux
ghogen Aug 15, 2024
53ec293
remove view
ghogen Aug 15, 2024
fec3379
updates
v-albemi Aug 15, 2024
0e63c2f
Update docs/extensibility/internals/registering-single-file-generator…
ghogen Aug 16, 2024
e527a51
updates
v-albemi Aug 16, 2024
38e54c7
updates
v-albemi Aug 16, 2024
0dcacce
updates
v-albemi Aug 16, 2024
d75f15e
updates
v-albemi Aug 16, 2024
ce9424d
updates
v-albemi Aug 16, 2024
f877e8f
Merge pull request #12915 from ghogen/registering1
prmerger-automator[bot] Aug 19, 2024
51ea0f0
Avoid "shortcut menu" (#12919)
ghogen Aug 19, 2024
2ee66b0
updates
v-albemi Aug 19, 2024
4d908f0
updates
v-albemi Aug 19, 2024
6c76227
updates
v-albemi Aug 19, 2024
14166ae
Update solutions-and-projects-in-visual-studio.md
MeeraDi Aug 19, 2024
e79e65c
updates
v-albemi Aug 19, 2024
107f590
Merge pull request #12928 from MicrosoftDocs/repo_sync_working_branch
Albertyang0 Aug 19, 2024
3ecc7da
Merge pull request #12911 from v-albemi/display-line-numbers
Stacyrch140 Aug 19, 2024
03fb98b
Merge pull request #12910 from v-albemi/specify-app-icon
AnnaMHuff Aug 19, 2024
dbe6b26
Merge pull request #12892 from v-albemi/solutions-projects
AnnaMHuff Aug 19, 2024
7f32449
Apply suggestions from PR review
AnnaMHuff Aug 19, 2024
d5217d4
Merge pull request #12906 from v-albemi/modify-visual-studio
AnnaMHuff Aug 19, 2024
7fd0589
Apply suggestions from PR review
AnnaMHuff Aug 19, 2024
a2c00f5
Merge pull request #12899 from v-albemi/create-solutions-projects
AnnaMHuff Aug 19, 2024
c9f3cc8
Merged main into live
mijacobs Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Registering Single File Generators
description: Learn how to register a custom tool in Visual Studio to instantiate it and associate it with a particular project type.
ms.date: 11/04/2016
ms.date: 08/15/2024
ms.topic: conceptual
helpviewer_keywords:
- registration, custom tools
Expand All @@ -15,21 +15,25 @@ ms.subservice: extensibility-integration

To make a custom tool available in Visual Studio, you must register it so Visual Studio can instantiate it and associates it with a particular project type.

The registry for Visual Studio is in a private hive, *privateregistry.bin*. Open *regedit.exe* and follow these instructions to load the private registry hive for the desired installation of Visual Studio: [Editing the registry for a Visual Studio instance](../../install/tools-for-managing-visual-studio-instances.md#editing-the-registry-for-a-visual-studio-instance).

### To register a custom tool

1. Register the custom tool DLL either in the Visual Studio local registry or in the system registry, under HKEY_CLASSES_ROOT.

For example, here's the registration information for the managed MSDataSetGenerator custom tool, which comes with Visual Studio:

```
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\CLSID\{E76D53CC-3D4F-40A2-BD4D-4F3419755476}]
[HKEY_LOCAL_MACHINE\{hive}\SOFTWARE\Microsoft\VisualStudio\17.0_**_Config\CLSID\{E76D53CC-3D4F-40A2-BD4D-4F3419755476}]
@="COM+ class: Microsoft.VSDesigner.CodeGenerator.TypedDataSourceGenerator.DataSourceGeneratorWrapper"
"InprocServer32"="C:\\WINDOWS\\system32\\mscoree.dll"
"ThreadingModel"="Both"
"Class"="Microsoft.VSDesigner.CodeGenerator.TypedDataSourceGenerator.DataSourceGeneratorWrapper"
"Assembly"="Microsoft.VSDesigner, Version=14.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a"
"Assembly"="Microsoft.VSDesigner, Version=17.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a"
```

The `{hive}` is the name you provided when you loaded *privateregistry.bin* in the registry editor, and the instance folder (shown here as `17.0_**_Config`) is specific to a particular installation of Visual Studio on your machine.

2. Create a registry key in the desired Visual Studio hive under Generators\\*GUID* where *GUID* is the GUID defined by the specific language's project system or service. The name of the key becomes the programmatic name of your custom tool. The custom tool key has the following values:

- (Default)
Expand All @@ -50,12 +54,12 @@ To make a custom tool available in Visual Studio, you must register it so Visual
For example, the MSDataSetGenerator registers itself once for each language:

```
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\Generators\{164b10b9-b200-11d0-8c61-00a0c91e29d5}\MSDataSetGenerator]
[HKEY_LOCAL_MACHINE\{hive}\SOFTWARE\Microsoft\VisualStudio\17.0_**_Config\Generators\{164b10b9-b200-11d0-8c61-00a0c91e29d5}\MSDataSetGenerator]
@="Microsoft VB Code Generator for XSD"
"CLSID"="{E76D53CC-3D4F-40a2-BD4D-4F3419755476}"
"GeneratesDesignTimeSource"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\Generators\{fae04ec1-301f-11d3-bf4b-00c04f79efbc}\MSDataSetGenerator]
[HKEY_LOCAL_MACHINE\{hive}\SOFTWARE\Microsoft\VisualStudio\17.0_**_Config\Generators\{fae04ec1-301f-11d3-bf4b-00c04f79efbc}\MSDataSetGenerator]
@="Microsoft C# Code Generator for XSD"
"CLSID"="{E76D53CC-3D4F-40a2-BD4D-4F3419755476}"
"GeneratesDesignTimeSource"=dword:00000001
Expand Down
66 changes: 34 additions & 32 deletions docs/ide/creating-solutions-and-projects.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Create projects & solutions"
description: Create and use Visual Studio solutions and projects to store artifacts, including source code files, bitmaps, icons, and component and service references.
ms.date: 08/08/2023
description: Create Visual Studio solutions and projects and use them to store artifacts, including source code files, bitmaps, icons, and component and service references.
ms.date: 08/19/2024
ms.topic: how-to
f1_keywords:
- vs.openprojectfromweb
Expand All @@ -12,116 +12,118 @@ author: anandmeg
ms.author: meghaanand
manager: mijacobs
ms.subservice: general-ide

#customer intent: As a developer, I want to learn how to create Visual Studio projects and solutions to store artifacts so that I can effectively manage my solutions.
---

# Create, work with, and delete Visual Studio projects and solutions

In this article, you'll learn how to create and use Visual Studio projects from scratch to store the artifacts you need to build your apps. If you aren't familiar with projects in Visual Studio, see this overview of [Projects and Solutions](solutions-and-projects-in-visual-studio.md). To learn how to quickly create a project from a template, see [Create a new project in Visual Studio](create-new-project.md).
In this article, you learn how to create Visual Studio projects from scratch and use them to store the artifacts you need to build your apps. If you aren't familiar with projects in Visual Studio, see [this overview of Projects and Solutions](solutions-and-projects-in-visual-studio.md). To learn how to quickly create a project from a template, see [Create a new project in Visual Studio](create-new-project.md).

*Projects* hold the items needed to build your app in Visual Studio, such as source code files, bitmaps, icons, and component and service references. When you create a new project, Visual Studio creates a *solution* to contain the project. You can then add other new or existing projects to the solution if you want. You can also create [blank or empty solutions](#create-empty-solutions). Solutions can also contain files that aren't connected to any specific project.

![Diagram that shows the solution and project hierarchy.](./media/vside-proj-soln.png)
:::image type="content" source="./media/vside-proj-soln.png" alt-text="Diagram that shows the solution and project hierarchy.":::

> [!NOTE]
> This topic applies to Visual Studio on Windows. For Visual Studio for Mac, see [Create projects in Visual Studio for Mac](/visualstudio/mac/create-new-projects).

You can view your solutions and projects in a tool window called **Solution Explorer**. The following screenshot shows an example C# console solution in **Solution Explorer** that contains two projects: **Calculator** and **CalculatorLibrary**. Each project contains multiple files and folders. The project name in bold is the *startup project*; that is, the project that starts when you run the app. You can specify which project is the startup project.
You can view your solutions and projects in a tool window called *Solution Explorer*. The following screenshot shows an example of a C# console solution in Solution Explorer. The solution contains two projects: **Calculator** and **CalculatorLibrary**. Each project contains multiple files and folders. The project name in bold is the *startup project*; that is, the project that starts when you run the app. You can specify which project is the startup project.

:::image type="content" source="media/solution-explorer-two-projects-inline.png" alt-text="Screenshot of Solution Explorer with two projects." lightbox="media/solution-explorer-two-projects-expanded.png":::
:::image type="content" source="media/solution-explorer-two-projects-inline.png" alt-text="Screenshot of two projects in Solution Explorer.":::

While you can construct a project yourself by adding the necessary files to it, Visual Studio offers a selection of project templates to give you a head start. Creating a new project from a template gives you a project with the essentials for that project type, and you can rename the files or add new or existing code and other resources to it as needed.
Although you can construct a project yourself by adding the necessary files to it, Visual Studio offers a selection of project templates to give you a head start. Creating a new project from a template gives you a project that has the essentials for that project type. You can rename the files or add new or existing code and other resources to the project as needed.

That being said, solutions and projects aren't required to develop apps in Visual Studio. You can also open code that you have cloned from Git or downloaded elsewhere. For more information, see [Develop code in Visual Studio without projects or solutions](../ide/develop-code-in-visual-studio-without-projects-or-solutions.md).
That said, you don't need to use solutions and projects to develop apps in Visual Studio. You can also open code that you have cloned from Git or downloaded from another source. For more information, see [Develop code in Visual Studio without projects or solutions](../ide/develop-code-in-visual-studio-without-projects-or-solutions.md).

## Create a project from a project template
## Create a project by using a project template

For information about how to select a template to create a new project, see [Create a new project in Visual Studio](create-new-project.md). And, for an example of a project and solution that's created from scratch, complete with step-by-step instructions and sample code, see [Introduction to projects and solutions](../get-started/tutorial-projects-solutions.md).
For information about how to select a template to create a project, see [Create a new project in Visual Studio](create-new-project.md). To construct a sample project and solution as an exercise, see [Introduction to projects and solutions](../get-started/tutorial-projects-solutions.md).

## Create a project from existing code files

If you have a collection of code source files, you can easily add them to a project.

1. On the menu, select **File** > **New** > **Project From Existing Code**.
1. On the Visual Studio menu, select **File** > **New** > **Project From Existing Code**.

1. In the **Create Project from Existing Code Files** wizard, select the project type you want in the **What type of project would you like to create?** drop-down list box, and then select the **Next** button.
1. In the **Create Project from Existing Code Files Wizard**, select the project type you want in the **What type of project would you like to create?** list, and then select **Next**.

1. In the wizard, browse to the location of the files and then enter a name for the new project in the **Name** box. When you're done, select the **Finish** button.
1. On the **Specify Project Details** page, browse to the location of the files and then enter a name for the new project in the **Name** box. When you're done, select **Finish**.

> [!NOTE]
> This option works best for a relatively simple collection of files. Currently, only C++, Apache Cordova, Visual Basic, and C# project types are supported.
> This option works best for a relatively simple collection of files. Currently, only C++, Visual Basic, and C# project types are supported.

## Add files to a solution

If you have a file that applies to multiple projects, such as a readme file for the solution, or other files that logically belong at the solution level rather than under a specific project, then you can add them to the solution itself. To add an item to a solution, on the context (right-click) menu of the solution node in **Solution Explorer**, select **Add** > **New Item**, or **Add** > **Existing Item**.
If you have a file that applies to multiple projects, like a readme file for the solution, or other files that logically belong at the solution level rather than under a specific project, you can add them to the solution itself. To add an item to a solution, on the context (right-click) menu of the solution node in Solution Explorer, select **Add** > **New Item** or **Add** > **Existing Item**.

> [!TIP]
> A solution file is a structure for organizing projects in Visual Studio. It contains the state of that information in two files: an *.sln* (text-based, shared) file, and an *.suo* (binary, hidden, user-specific solution options) file. Thus, a solution isn't something that should be copied and renamed; instead, it's best to create a new solution and then add existing items to it.
> A solution file is a structure for organizing projects in Visual Studio. It contains the state of solution information in two files: an *.sln* (text-based, shared) file and an *.suo* (binary, hidden, user-specific solution options) file. Therefore, you shouldn't copy and rename a solution. It's best to create a new solution and then add existing items to it.

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

### Compare files

Starting with [version 17.7](/visualstudio/releases/2022/release-notes), you can compare files in Solution Explorer by using the right-click context menu options. For more information, see [**The file comparison tool**](use-solution-explorer.md#the-file-comparison-tool) section of the [Learn about Solution Explorer](use-solution-explorer.md) page.
Starting with [version 17.7](/visualstudio/releases/2022/release-notes), you can compare files in Solution Explorer by using the right-click context menu options. For more information, see [The file comparison tool](use-solution-explorer.md#the-file-comparison-tool) in [Learn about Solution Explorer](use-solution-explorer.md).

::: moniker-end

## Create a .NET project that targets a specific version of the .NET Framework

When you create a .NET Framework project, you can specify a specific version of the .NET Framework that you want the project to use. (When you create a .NET Core project, you don't specify a framework version.)

To specify a .NET Framework version, select the **Framework** drop-down menu on the **Configure your new project** page.
To specify a .NET Framework version, select an item in the **Framework** list on the **Configure your new project** page.

::: moniker range="vs-2019"

![Screenshot of the Framework selector in the 'Configure new project' dialog box in Visual Studio 2019.](media/vs-2019/configure-new-project-framework.png)
:::image type="content" source="media/vs-2019/configure-new-project-framework.png" alt-text="Screenshot of the Framework dropdown list in the Configure new project dialog in Visual Studio 2019.":::

::: moniker-end

::: moniker range="vs-2022"

:::image type="content" source="media/vs-2022/configure-new-project-framework.png" alt-text="Screenshot of the Framework selector in the 'Configure new project' dialog box.":::
:::image type="content" source="media/vs-2022/configure-new-project-framework.png" alt-text="Screenshot of the Framework dropdown list in the Configure new project dialog.":::

::: moniker-end

## Create empty solutions

You can also create empty solutions that have no projects. This might be preferable in cases where you want to construct your solution and projects from scratch.
You can also create empty solutions that don't contain projects. This option might work well when you want to construct your solution and projects from scratch.

### To create an empty solution

1. On the menu bar, select **File** > **New** > **Project**.

2. On the **Create a new project** page, type **solution** into the search box.
1. On the **Create a new project** page, enter **solution** in the search box.

3. Select the **Blank Solution** template, and then select **Next**.
1. Select the **Blank Solution** template, and then select **Next**.

4. Enter **Name** and **Location** values for your solution, and then select **Create**.
1. Enter **Solution name** and **Location** values for your solution, and then select **Create**.

After you create an empty solution, you can add new or existing projects or items to it by choosing **Add New Item** or **Add Existing Item** on the **Project** menu.
After you create an empty solution, you can add new or existing projects or items to it by selecting **Add New Item** or **Add Existing Item** on the **Project** menu.

As mentioned earlier, you can also open code files without needing a project or solution. To learn about developing code in this way, see [Develop code in Visual Studio without projects or solutions](../ide/develop-code-in-visual-studio-without-projects-or-solutions.md).
As noted earlier, you can also open code files without using a project or solution. To learn about developing code in this way, see [Develop code in Visual Studio without projects or solutions](../ide/develop-code-in-visual-studio-without-projects-or-solutions.md).

## Delete a solution, project, or item

You can use the right-click context menu to either delete or remove solutions, projects, or items in Visual Studio, but that only removes them from the current solution or project.
You can use the right-click context menu to delete or remove solutions, projects, or items in Visual Studio, but that only removes them from the current solution or project.

To permanently delete a solution or other components from your system, use **File Explorer** in Windows to delete the folder that contains the *.sln* and *.suo* solution files. (Before you delete a solution, you might want to back up your projects and files in case you need them again.)
To permanently delete a solution or other components from your system, use File Explorer in Windows to delete the folder that contains the *.sln* and *.suo* solution files. (Before you delete a solution, you might want to back up your projects and files in case you need them again.)

> [!NOTE]
> The *.suo* file is a hidden file that isn't displayed under the default File Explorer settings. To show hidden files, on the **View** menu in File Explorer, select the **Hidden Items** checkbox.
> The *.suo* file is a hidden file that isn't displayed if you use the default File Explorer settings. To show hidden files, on the **View** menu in File Explorer, select **Show** > **Hidden items**.

### Permanently delete a solution

You can access File Explorer in Windows by using Solution Explorer in Visual Studio. Here's how.

1. In **Solution Explorer**, on the right-click menu (context menu) of the solution you want to delete, select **Open folder in File Explorer**.
1. In Solution Explorer, on the right-click menu of the solution you want to delete, select **Open Folder in File Explorer**.

1. In File Explorer, navigate up one level.

1. Select the folder that contains the solution, and then press the **Delete** key.
1. Select the folder that contains the solution, and then select the Delete key.

## Related content

- [Introduction to projects and solutions](../get-started/tutorial-projects-solutions.md)
- [Manage project and solution properties](managing-project-and-solution-properties.md)
- [Filtered solutions in Visual Studio](filtered-solutions.md)
- [Developer code samples](/samples/browse/)
Loading