The name of the application executable is different from the name of the vshost executable

I have a problem where my vshost.exe file name is different from my actual application.exe file name, preventing me from debugging the application.

The configuration is as follows:

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

I am using Visual Studio 2012, .NET 4.0 and InstallShield LE.

Now, for reasons beyond my control, it was decided that the executable name of the application should contain the environment: MyApplication (Release).exe , MyApplication (Debug).exe , MyApplication (Testing).exe .

This is easy to do by changing the .csproj file to the following:

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

When creating an application in Debug it generates the following files in my bin/Debug folder:

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

So far so good.

When creating an application in Testing it generates the following files in my bin/Testing folder:

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

As you can see, the generated vshost files are named differently, which causes Visual Studio to throw the following error when trying to debug:

Visual Studio cannot start debugging because the debugging target 'D: \ Code \ MySolution \ MyApplication \ bin \ Testing \ MyApplication (Debug) .exe' is missing, missing. Please create a project and try again, or set OutputPath and AssemblyName to indicate the correct location of the target assembly.

Interestingly, if I changed the AssemblyName the Debug configuration to MyApplication (Foo) , then the vhost files in the Testing folder are also renamed MyApplication (Foo) . So, something forces me to use my Debug configuration in my Testing configuration. But what?

Currently, I can get around this by running the application and then plugging in the Visual Studio debugger, but it is wasting its time. This is also not a problem when creating the installer, because vshost files are simply ignored.

So far, Google has not really helped. Most of the search results explain what a vshost file is and how it works, but that’s not what I need. I need to know why vshost files are named differently and how I can fix it.

+7
visual-studio-2012 msbuild csproj visual-studio-debugging
source share
1 answer

Another workaround might be to disable the vshost option:

Go to the tab "Project + Properties", "Debug", uncheck the box "Enable the Visual Studio hosting process."

0
source share

All Articles