无法启动调试。启动项目无法启动

我已经在 VS2015中启动了一个新的控制台项目。我只有这个代码:

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");
}
}
}

当我试图逃跑时,我得到了这个:

无法启动调试。启动项目无法启动。 验证启动项目的调试设置。

我该怎么办? 谢谢。

101201 次浏览

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.

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

A very meaningless error....

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

Solved with restart of Visual Studio.

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 Visual Studio popup: "the operation could not be completed" it was enough to close Visual Studio 2015 and then open again.

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.

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

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

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.

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

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.

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

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.

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.

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.

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

Close the Visual Studio and re-open it again.

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.

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.

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.

Just restart your visual studio and run as admin.

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"

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.

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

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.

I got this problem solved by clearing MEF component cache.

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

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

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.

enter image description here

Working enter image description here

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.

@Flowerking's commend did it for me.

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

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.

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.

In my case the issue was solved after selecting correct build configuration for startup project in Configuration Manager.

The build configuration of solution was set to Debug x64, but in Configuration Manager (at Build -> Configuration Manager...) exe project had platform as Any CPU. For this setup I was unable to debug project with "Unable to start debugging" message. After switching platform for exe project to the same x64, I was able to run it under debugger.