7

我遇到了问题,其中我的vshost.exe文件名与我的实际application.exe文件名不同,这使我无法调试该应用程序。应用程序可执行文件名称与vshost可执行文件名称不同

的设置如下:

- MySolution 
    - Installer.Release 
    - Installer.Debug 
    - Installer.Testing 
    - MyApplication 

我使用Visual Studio 2012,.NET 4.0和InstallShield LE。

现在,由于我无法控制的原因,决定应用程序可执行文件名称应该包含环境:MyApplication (Release).exe,MyApplication (Debug).exe,MyApplication (Testing).exe

这是很容易的.csproj文件中修改以下做:

<AssemblyName>MyApplication (Release)</AssemblyName> 
<AssemblyName Condition="'$(Configuration)' == 'Debug'">MyApplication (Debug)</assemblyName> 
<AssemblyName Condition="'$(Configuration)' == 'Testing'">MyApplication (Testing)</AssemblyName> 

Debug构建应用程序在我bin/Debug文件夹中生成以下文件:

MyApplication (Debug).exe 
MyApplication (Debug).exe.config 
MyApplication (Debug).vshost.exe 
MyApplication (Debug).vshost.manifest 

到目前为止好。

当建立在Testing的应用程序,它会生成以下文件在我bin/Testing文件夹:

MyApplication (Testing).exe 
MyApplication (Testing).exe.config 
MyApplication (Debug).vshost.exe 
MyApplication (Debug).vshost.manifest 

正如你所看到的,所产生的被命名为不同的vshost文件,这将导致Visual Studio来扔

的Visual Studio无法启动调试,因为调试目标 'd:\代码\ MySolution \ MyApplication的\ BIN \测试\ MyApplication的(调试).EXE'尝试调试时出现以下错误缺少。请构建项目并重试,或适当地设置OutputPath 和AssemblyName属性,以指向目标程序集的正确 位置。

有趣的是,如果我改变Debug配置的AssemblyNameMyApplication (Foo),然后在Testing文件夹中的虚拟主机文件也被重命名为MyApplication (Foo)。所以有些东西强制将Debug配置用于我的Testing配置。但是什么?

目前我可以通过启动应用程序然后附加Visual Studio调试器来解决它,但这是在浪费我的时间。构建安装程序也不是问题,因为vshost文件被忽略。

到目前为止谷歌并没有真正有用。大多数搜索结果解释了什么是vshost文件以及它如何工作,但这不是我所需要的。我需要知道为什么vshost文件命名不同,以及我如何解决这个问题。

回答

0

另一个解决方法可以禁用vshost选项:

转到项目+属性,调试选项卡,取消勾选“启用在Visual Studio宿主进程”选项。

相关问题