Unable to start debugging. The startup project could not be launched. VS2015

C#Visual StudioVisual Studio-2015

C# Problem Overview


I have started a new console project in VS2015. I only have this code :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SautinSoft;

namespace PdfParser
{
    class Program
    {
        static void Main(string[] args)
        {

            string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            SautinSoft.PdfFocus f = new PdfFocus();
            f.OpenPdf(@"path:\abc.pdf");

            if (f.PageCount > 0)
                f.ToExcel(@"path:\abc.xls");
        }
    }
}

When I try to run, I get this :

> Unable to start debugging. The startup project could not be launched. > Verify debug settings for the startup project.

How can I fix this? Thanks.

C# Solutions


Solution 1 - C#

After upgrading MSVC2015 to Update3, I had the same problem: instead of std::map in the Watch window display as a horrible std::_Tree<std::_Tmap_traits... etc., some plugins started to throw exceptions, some projects was not able to run in debug mode.

All was solved by deleting CurrentSettings.vssettings. It is usually located at Documents\Visual Studio 2015\Settings If not, go to `Tools -> Options -> Environment -> Import and Export Settings ' to find the location of this file.

Solution 2 - C#

Had this on a brand new scaffolded ASP.NET Core 1.0 web application.

Solved with restart of Visual Studio.

Solution 3 - C#

I was also stuck with this. I removed both bin & obj folders, did a rebuild, and then it launched.

A very meaningless error....

Solution 4 - C#

I had this problem when I tried to start (without) Debugging my Asp.Net MVC project

are you running Visual studio as Administrator

> so just restart visual studio As Administrator

Solution 5 - C#

Additionally to "Unable to start debugging" I also had errors "The operation could not be completed: Unspecified error" when I tried to rebuild.
Thanks to https://stackoverflow.com/questions/9079466/visual-studio-popup-the-operation-could-not-be-completed/33009291#33009291 it was enough to close Visual Studio 2015 and then open again.

Solution 6 - C#

Make sure you're launching Visual Studio as Administrator.

  1. Right click on the Visual Studio 2015 Shortcut
  2. Select the Shortcut tab
  3. Click on Advanced
  4. Check the box to "Run as administrator" at all times(see below)

This has resolved the issue for me with the exact error message in question.

It is not ideal to run the VS in administrator mode at all times. Make sure you un-check the box once your issue has been resolved.

Solution 7 - C#

There is no need to delete everything in my case, I just opened the

> "CurrentSettings.vssettings"

file and commented this property

<PropertyValue name="DefaultBehaviorForStartupProjects">1</PropertyValue>

and everything fixed.

Sample

Solution 8 - C#

I just had the same problem and solved it by deleting the .vs directory in the project directory.

Solution 9 - C#

VS 2019, two Core 3.1 projects (an MVC and an API), brand new projects created, no other changes to the solution or projects.

I kept getting the referenced error when trying to start both projects within the IDE, despite having checked all the things already mentioned in this SO.

However, I finally realized, I forgot to specify the "Action" after switching the solution to "Multiple startup projects" (they were both still set to "None"). Right-click solution in "Solution Explorer", choose "Properties" (at very bottom).

Such a ridiculously simple thing. Hope it helps someone else.

"Broken" enter image description here

Working enter image description here

Solution 10 - C#

Just delete the .vs hidden folder. This folder resides at the same location where the sln file is. Deleting this folder also refreshes intellisense cache and would fix any issues with that. Hope this helps.

Solution 11 - C#

Delete all relevant /obj and /bin folders. Run again.

Solution 12 - C#

Close the Visual Studio and re-open it again.

Solution 13 - C#

Just restart your visual studio and run as admin.

Solution 14 - C#

I had this with a Xamarin.iOS project in my Xamarin.Forms solution. I tried every suggestion here, without success.

The source of the error was a misconfigured .csproj of the project. I never edited it myself and not even touched the project properties. I use Visual Studio 2017 RC. I came across the solution when I compared the project file with previous versions on Source Control.

Solution: Compare the project file with a previous version and try to granually revert changes until you eliminated the problem and know what the cause was.

Solution 15 - C#

The solution for me was to delete all *.user files that are normally generated for both solution and project files

Solution 16 - C#

I found this problem too. But after restart the Visual Studio Community 2015 as an administrator I found new problem :

problem

And then I try to open another solution, close the another solution, and open the solution which the problem occur, then the problem solved.

Solution 17 - C#

Had the Same Issue with the existing application, I deleted the vs settings but still the issue remained,

Finally i just restarted the VS and it worked fine.

I think sometimes when we load the project some library doesn't get loaded with the solution so the best option before doing anything is simply restarting the VS.

Solution 18 - C#

After adding a project reference 'MyProjectReference' to my app, then removing it, I was also getting the same error :

> Unable to start debugging . The startup project could not be launched. > Verify debug settings for the startup project.

Deleting configuration, running as admin, restarting VS, rebooting machine all had no effect.

After running my web app without debugging (Right-Click Project -> View In Browser (Google Chrome) I got a much more useful error:

> Could not load file or assembly 'MyProjectReference' or one of its > dependencies. An attempt was made to load a program with an incorrect > format.

My Solution was then to re-add back to the solution, then remove it again. After that rebuild and debug worked.

Solution 19 - C#

How I fixed my issue, I closed project that had that error , created new project build new project then opened the project that had an issue and build it. That worked for me.

Solution 20 - C#

Make sure you close all instances of Visual Studio and then restart as Administrator. In my case I had multiple instances of Visual Studio open and I had to close them all and then restart Visual Studio as admin in order to get things working.

Solution 21 - C#

I had visual studio 2015 with an ASP.net MVC5 arcitectured with DDD (Domain Driven Design). The problem was the same since I just opened visual studio normally.

The problem was solved when I closed all instance visual studio and restarted as an adminstrator.

Solution 22 - C#

I also faced to this issue in VS 2015 , but finally I resolved it by following bellow steps

In VS go to : Tools -> Options - > Projects and Solutions -> Build and Run

Select "Always Build" in "On Run when project are out of date"

Solution 23 - C#

This issue happened to me with the Latest VS2019.
I've tried everything here, but unfortunately without any result.

Finally, I've restarted the IIS server, also manually Recycled the "Default Application Pool".
After debugging issue fixed.

Solution 24 - C#

For me solution was to run testapp.csproj instead of testapp.sln. This can be selected from drop down next to green play button.

Solution 25 - C#

Simply updated visual studio which then prompted PC restart. This is what fixed the problem for me.

Note: I tried some of the above / below but to no avail.

Solution 26 - C#

I got this problem solved by clearing MEF component cache.

Use this VS Extension to clear cache very easily.!!

Solution 27 - C#

I stop debugging and exit the projects from IIS Express then clean and build the project and my error is gone.

Solution 28 - C#

I get this running as non-Adminsitrator in Visual Studio 2019 16.2.5, with two .NET Core projects.

The solution I found is to set at least one of the projects as "Start" (in Solution's Property Page). If both are set to "Start without Debugging" it fails. This happens even if I want to start the entire project without any debugging (Ctrl+F5).

Bug. Still unaddressed by Microsoft and their bug page issue report it is closed as unreproducible.

Solution 29 - C#

@Flowerking's commend did it for me.

Right click on you project and select "Set as StartUp Project".

Solution 30 - C#

I had this problem developing a react native app for windows in Visual Studio 2019. I started the debugger then stopped it in the terminal by using ctrl-C. I was not able to restart the debugger and the "start debugging" and "start without debugging" options were disabled in the debug dropdown. Restarting Visual Studio, etc, and some of the things described above did not work. Through hunting and testing, I noticed that if I switched views in the Solution Explorer to the MyProject.sln instead of the fileview, the debugging was enabled again. I'm not sure why, but it appears I need to be in the sln view to start the debugger.

Solution 31 - C#

I had previously changed some debug settings back and forth when this problem occurred for me. What worked for me was to go to Property Pages, click on "Debugging" in Configuration Properties, make sure "Local Windows Debugger" was used, set "Attach" to "Yes", run the solution one and then change "Attach" back to "No" again. After this it worked again.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjasonView Question on Stackoverflow
Solution 1 - C#mr NAEView Answer on Stackoverflow
Solution 2 - C#fiatView Answer on Stackoverflow
Solution 3 - C#James JoyceView Answer on Stackoverflow
Solution 4 - C#Basheer AL-MOMANIView Answer on Stackoverflow
Solution 5 - C#Michael FreidgeimView Answer on Stackoverflow
Solution 6 - C#wonsterView Answer on Stackoverflow
Solution 7 - C#UntherxadyusView Answer on Stackoverflow
Solution 8 - C#Mark ReidView Answer on Stackoverflow
Solution 9 - C#t.j.View Answer on Stackoverflow
Solution 10 - C#MrDebnathView Answer on Stackoverflow
Solution 11 - C#StachuView Answer on Stackoverflow
Solution 12 - C#Arshath ShameerView Answer on Stackoverflow
Solution 13 - C#kirti kant pareekView Answer on Stackoverflow
Solution 14 - C#user4344677View Answer on Stackoverflow
Solution 15 - C#EmilView Answer on Stackoverflow
Solution 16 - C#Satria JanakaView Answer on Stackoverflow
Solution 17 - C#VivekView Answer on Stackoverflow
Solution 18 - C#SilmarView Answer on Stackoverflow
Solution 19 - C#Xolani DlovaView Answer on Stackoverflow
Solution 20 - C#Josh SieglView Answer on Stackoverflow
Solution 21 - C#HedegoView Answer on Stackoverflow
Solution 22 - C#sachith walpitaView Answer on Stackoverflow
Solution 23 - C#Arsen KhachaturyanView Answer on Stackoverflow
Solution 24 - C#Honza SlesingerView Answer on Stackoverflow
Solution 25 - C#MwizaView Answer on Stackoverflow
Solution 26 - C#GambitierView Answer on Stackoverflow
Solution 27 - C#shahidaView Answer on Stackoverflow
Solution 28 - C#claudiView Answer on Stackoverflow
Solution 29 - C#FelixView Answer on Stackoverflow
Solution 30 - C#Bryan AneuxView Answer on Stackoverflow
Solution 31 - C#Christian LarssonView Answer on Stackoverflow