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.
4,066 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,377 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.
11,237 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 32,426 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.


  2. Luppnow, L. (La'Chelle) 0 Reputation points
    2025-01-12T18:14:35.7333333+00:00

    I solved this by updating the .vbproj file. I had to add the Project Type Guids to the "PropertyGroup" tag. <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>. In this case GUID 349c5851-65df-11da-9384-00065b846f21 is for ASP.NET MVC 5 and F184B08F-C81C-45F6-A57F-5ABD9991F28F for VB.NET. Have a look at GitHub List of GUIDS. Multiple Guids can be added, separated by a semicolon.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.