Publish option is gone from context menu in VS2017
Asked Answered
O

3

5

So I'm trying to publish a project, but for whatever reason I can't. The very last project that I added still gives me the option to do it, but none of the other projects allow me to do it. The publish option is missing from the context menu (see snippets). I tried to change the guid as explained in this article, but no luck.

Publish

No publish

How do I publish my projects??

Thanks for the help in advance!

By the way I'm using Visual Studio Community 2017

Oak answered 1/6, 2018 at 19:29 Comment(5)
What kind of a project is it? To publish it, it has to be some kind of web api, as far as I remember. For example you can not publish a class library or a unit test project. Make sure the output format is "exe"Duwalt
Oh yeah I should have mentioned that. It is a console application, and it does produce an .exe file.Oak
You can not publish a console app, as it needs to be some web api stuff. Try a web api to be able to publish.Duwalt
The other project that I have it's also a console application. Both snippets that I show in the question come from a console application, but one does let me publish it while the other one doesn't.Oak
hmm have you checked the difference of the .csproj files? I always thought publish was only for web stuff, as you want to push it somehere. This does not make much sense for a console app, in my opinion. Maybe this helps learn.microsoft.com/en-gb/dotnet/core/tutorials/…Duwalt
O
3

So I haven't been able to figure out why the menu is missing, but I found a way to publish it via the command line which ends up being the same. Using a cmd with admin rights navigate to the project you want to publish and use these commands:

set Platform=
set ASPNETCORE_ENVIRONMENT=
dotnet publish -c Release -o bin\Release\PublishOutput

-c specifies the configuration {Debug|Release}, and -o the relative output location. For more info go to the documentation of dotnet

Oak answered 2/6, 2018 at 23:27 Comment(2)
Not working for me. I tried: dotnet publish -c Release -o .\PublishOutput .\TmSmsWebApi.sln /p:Platform="Any CPU" and it seemed to work but no output folder. The output is a little odd: " Determining projects to restore... All projects are up-to-date for restore."Psychosomatics
What do you set ASPNETCORE_ENVIRONMENT to? (I'm not using .NET core BTW, if that is relevant).Psychosomatics
S
3

I fixed this issues by using VS installer ,selected web development options and installed it. After installing web development settings I can publish option.

Spiritless answered 20/8, 2019 at 7:29 Comment(0)
D
0

I dont know why is there this problem but when I created a new project which had an extra ".NET" in brackets, it solved the problem.

Dolores answered 31/7, 2021 at 8:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.