简体   繁体   English

无法开始调试。 无法启动启动项目。 VS2015

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

I have started a new console project in VS2015.我在 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.谢谢。

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.将 MSVC2015 升级到 Update3 后,我遇到了同样的问题:而不是 Watch 窗口中的std::map显示为可怕的std::_Tree<std::_Tmap_traits...等等,一些插件开始抛出异常,一些项目无法在调试模式下运行。

All was solved by deleting CurrentSettings.vssettings .通过删除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.它通常位于Documents\\Visual Studio 2015\\Settings如果没有,请到 `Tools -> Options -> Environment -> Import and Export Settings' 找到这个文件的位置。

Had this on a brand new scaffolded ASP.NET Core 1.0 web application.在一个全新的脚手架 ASP.NET Core 1.0 Web 应用程序上有这个。

Solved with restart of Visual Studio.通过重新启动 Visual Studio 解决。

I was also stuck with this.我也被这个问题困住了。 I removed both bin & obj folders, did a rebuild, and then it launched.我删除了 bin 和 obj 文件夹,进行了重建,然后启动了。

A very meaningless error....一个非常无意义的错误......

I had this problem when I tried to start (without) Debugging my Asp.Net MVC project当我尝试start (without) Debugging我的 Asp.Net MVC project时遇到了这个问题

are you running Visual studio as Administrator您是否以Administrator身份运行 Visual Studio

so just restart visual studio As Administrator所以只需以Administrator身份restart 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 .感谢Visual Studio 弹出:“操作无法完成”关闭 Visual Studio 2015 然后再次打开就足够

Make sure you're launching Visual Studio as Administrator.确保以管理员身份启动 Visual Studio。

  1. Right click on the Visual Studio 2015 Shortcut右键单击 Visual Studio 2015 快捷方式
  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.始终以管理员模式运行 VS 并不理想。 Make sure you un-check the box once your issue has been resolved.一旦您的问题得到解决,请确保取消选中该框。

There is no need to delete everything in my case, I just opened the在我的情况下不需要删除所有内容,我只是打开了

"CurrentSettings.vssettings" “当前设置.vssettings”

file and commented this property归档并评论此属性

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

and everything fixed.一切都固定了。

Sample样品

我刚刚遇到了同样的问题,并通过删除项目目录中的 .vs 目录来解决它。

Just delete the .vs hidden folder.只需删除 .vs 隐藏文件夹。 This folder resides at the same location where the sln file is.此文件夹位于 sln 文件所在的同一位置。 Deleting this folder also refreshes intellisense cache and would fix any issues with that.删除此文件夹还会刷新智能感知缓存,并会解决任何问题。 Hope this helps.希望这会有所帮助。

VS 2019, two Core 3.1 projects (an MVC and an API), brand new projects created, no other changes to the solution or projects. VS 2019,两个 Core 3.1 项目(一个 MVC 和一个 API),创建了全新的项目,对解决方案或项目没有其他更改。

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.尽管已经检查了本 SO 中已经提到的所有内容,但在尝试在 IDE 中启动两个项目时,我一直收到引用的错误。

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" “破碎” 在此处输入图片说明

Working工作在此处输入图片说明

Delete all relevant /obj and /bin folders.删除所有相关的 /obj 和 /bin 文件夹。 Run again.再跑。

关闭 Visual Studio 并重新打开它。

只需重新启动您的 Visual Studio 并以管理员身份运行。

I had this with a Xamarin.iOS project in my Xamarin.Forms solution.我在 Xamarin.Forms 解决方案中有一个 Xamarin.iOS 项目。 I tried every suggestion here, without success.我在这里尝试了所有建议,但都没有成功。

The source of the error was a misconfigured .csproj of the project.错误的根源是项目的 .csproj 配置错误。 I never edited it myself and not even touched the project properties.我从来没有自己编辑过它,甚至没有触及项目属性。 I use Visual Studio 2017 RC.我使用 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.解决方案:将项目文件与以前的版本进行比较,并尝试逐步还原更改,直到您消除问题并了解原因为止。

我的解决方案是删除通常为解决方案和项目文件生成的所有*.user文件

I found this problem too.我也发现了这个问题。 But after restart the Visual Studio Community 2015 as an administrator I found new problem :但是在以管理员身份重新启动 Visual Studio Community 2015 后,我发现了新问题:

问题

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,与现有应用程序存在相同问题,我删除了 vs 设置,但问题仍然存在,

Finally i just restarted the VS and it worked fine.最后我只是重新启动了 VS,它工作正常。

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.我认为有时当我们加载项目时,某些库不会加载解决方案,因此在做任何事情之前最好的选择就是重新启动 VS。

After adding a project reference ' MyProjectReference ' to my app, then removing it, I was also getting the same error :将项目引用“ MyProjectReference ”添加到我的应用程序,然后将其删除后,我也遇到了同样的错误:

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.删除配置,以管理员身份运行,重启VS,重启机器都没有效果。

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.无法加载文件或程序集“ MyProjectReference ”或其依赖项之一。 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.在那之后重建和调试工作。

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.确保关闭 Visual Studio 的所有实例,然后以管理员身份重新启动。 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.就我而言,我打开了多个 Visual Studio 实例,我必须将它们全部关闭,然后以管理员身份重新启动 Visual Studio 才能使事情正常进行。

I had visual studio 2015 with an ASP.net MVC5 arcitectured with DDD (Domain Driven Design).我有一个 ASP.net MVC5 的 Visual Studio 2015,用 DDD(域驱动设计)架构。 The problem was the same since I just opened visual studio normally.问题是一样的,因为我刚刚正常打开了visual studio。

The problem was solved when I closed all instance visual studio and restarted as an adminstrator.当我关闭所有实例 Visual Studio 并以管理员身份重新启动时,问题就解决了。

I also faced to this issue in VS 2015 , but finally I resolved it by following bellow steps我在 VS 2015 中也遇到过这个问题,但最后我按照以下步骤解决了这个问题

In VS go to : Tools -> Options - > Projects and Solutions -> Build and Run在 VS 中:工具 -> 选项 -> 项目和解决方案 -> 构建和运行

Select "Always Build" in "On Run when project are out of date"在“项目过期时运行时”中选择“始终构建”

This issue happened to me with the Latest VS2019.这个问题发生在我最新的 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".最后,我重新启动了 IIS 服务器,还手动回收了“默认应用程序池”。
After debugging issue fixed.调试问题修复后。

For me solution was to run testapp.csproj instead of testapp.sln .对我来说,解决方案是运行testapp.csproj而不是testapp.sln This can be selected from drop down next to green play button.这可以从绿色播放按钮旁边的下拉菜单中选择。

Simply updated visual studio which then prompted PC restart.只需更新 Visual Studio,然后提示 PC 重新启动。 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.我通过清除 MEF 组件缓存解决了这个问题。

Use this VS Extension to clear cache very easily.!!使用此VS 扩展程序可以非常轻松地清除缓存。!!

我停止调试并从 IIS Express 退出项目,然后清理并构建项目,我的错误消失了。

I get this running as non-Adminsitrator in Visual Studio 2019 16.2.5, with two .NET Core projects.我在 Visual Studio 2019 16.2.5 中以非管理员身份运行,有两个 .NET Core 项目。

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.如果两者都设置为“Start without Debugging”,则失败。 This happens even if I want to start the entire project without any debugging (Ctrl+F5).即使我想在没有任何调试的情况下启动整个项目 (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. @Flowerking 的推荐为我做到了。

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.我在 Visual Studio 2019 中为 Windows 开发 React Native 应用程序时遇到了这个问题。我启动了调试器,然后使用 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.重新启动 Visual Studio 等,上面描述的一些事情不起作用。 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.通过搜索和测试,我注意到如果我将解决方案资源管理器中的视图切换到 MyProject.sln 而不是文件视图,则再次启用了调试。 I'm not sure why, but it appears I need to be in the sln view to start the debugger.我不知道为什么,但似乎我需要在 sln 视图中才能启动调试器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM