No publish option C# console app VS 2022

Thibaut Bournonville 0 Reputation points
2023-10-05T19:34:54.45+00:00

Following a C# tutorial telling me to use the "Publish Selection" on my code, but in can't find it anywhere.

I've tried installing stuff into my VS but it changed nothing.

Did I miss something?

Capture d'écran 2023-10-05 212959

Capture d'écran 2023-10-05 212948

Capture d'écran 2023-10-05 213148

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,472 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,715 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,408 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,981 Reputation points Microsoft Vendor
    2023-10-06T02:40:21.46+00:00

    Hello @Thibaut Bournonville ,

    Welcome to Microsoft Q&A forum.

    Are you using any extension? Did you change any VS settings?

    Please try following methods:

    1. Close VS, open VS Installer, select Modify, uncheck ".NET desktop development" workload, click Modify, check it again and click Modify again to reinstall ".NET desktop development" workload.
    2. Try to install "ASP.NET and web development" workload and check if the publish option appears.
    3. Reset VS settings by opening(type and search in Windows Search box to open it) Developer Command Prompt for Visual Studio 2022 and run devenv /ResetSettings command.
    4. Try to create a new C# Console application, but let it base on .NET Framework, check if the Publish option is available.

    User's image

    Workaround: try to use dotnet CLI to publish your project. If above methods don’t work, you may open a command line tool, for example CMD, and use command like cd C:\MyFirstProject, dotnet publish, or configure the .pubxml file(create one and customize it), then use dotnet publish -p:PublishProfile=MyPublishProfile to publish your project as a temporarily workaround(see this document: dotnet publish for more details).


    Update1:

    If this issue still occurs, please try to update Visual Studio 2022 to the latest version and reinstall the .NET desktop development workload, then create a new project and test again.

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.