77

I have migrated from Visual Studio 2008 to VS 2017.

I am getting this error when I try to run project with the green play button:

enter image description here

Obviously I have to select a valid startup item, but there are two pieces of information I need to do that:

  1. what are typical valid startup items that I can try to select?

  2. How do I select them?

I am a long time developer, but I am new to visual studio so please give me instructions based on terminology I can see on the screen.

Be Kind To New Users
  • 9,672
  • 13
  • 78
  • 125
  • I solution explorer open context menu over project you want to be a startup and chose "Set as startup project". But probably you don't have proper project since of some deprecations. Tell what project types you have in your solution – Pavel Agarkov Dec 03 '17 at 20:28
  • I do not have a project in my solution explorer view. I only have folders. So that is the clue... I need to create a project. How do I do that? – Be Kind To New Users Dec 03 '17 at 20:34
  • There is not .sln file. The closest thing I have is a web.config file. – Be Kind To New Users Dec 03 '17 at 20:37
  • Probably you do have it - try to switch between folder view to project view - there is a button on the solution explorer toolbox. if you actually don't have a project then if you were converting a website folder - instead you can try to create an empty solution and just add "Existing website" – Pavel Agarkov Dec 03 '17 at 20:39
  • Have you open the project file direct with VS or in VS with open? – Lord_Curdin Dec 04 '17 at 13:23

6 Answers6

90

It might be the case that you have opened your project using

File->Open->Folder

Use the right method to open your project using

File->Open->Project/Solution

or

File->Open->Website
Regolith
  • 2,944
  • 9
  • 33
  • 50
Milind Bankar
  • 1,040
  • 8
  • 5
36

File > New > Project From existing code. Select type of project > Next. Enter project name > Finish.

Alain
  • 411
  • 4
  • 2
4

I went to File > Open > project/Solution and found the ".sln" file. I clicked on it and then pressed open and it worked for me. Just spent ages trying to figure this out!

Regards,

3

Open Visual Studio ------------------

  1. Click File
  2. Click Open
  3. Open as Web Sites

Another method

  1. Click File
  2. Click Open
  3. Open as Project
  • Hello @iamkanaramyadev. Welcome to stack overflow. This answer was a copy paste from the accepted answer. I recommend you improve it and perhaps explain better when each case exists as a way to add value to the question. If you are unable to do that you might get downvoted and lose reputation. – Be Kind To New Users Nov 30 '20 at 06:05
1

I found this question after I did File → Open → Folder as well. However in my case it's not a website, all I have is a source file. I don't want to create a full solution.

Now that Visual Studio supports CMake (to some degree), easiest is to add a simple CMakeLists.txt file, like this:

project (theproject)
add_executable (thetarget source.cpp)

As soon as the folder contains this file, Set as Startup Item turns up as a menu item in the Solution Explorer!

Michel de Ruiter
  • 7,131
  • 5
  • 49
  • 74
-3

The only solution is that or this error:

please select a valid startup file is that repair your visual studio

double click on visual studio installer and then click on the More then repair your visual studio

user229044
  • 232,980
  • 40
  • 330
  • 338