I have a project that has been working fine in Visual Studio 2013 that is written in C# using WPF. This project has a few dependencies:
- GalaSoft.MvvmLight Toolkit
- Newtonsoft.Json
- Xceed.Wpf.Toolkit
Prior to last night the project has been working fine, ran and was able to be debugged without issue. However, last night when deciding to work on the project, I opened and tried compiling then debugging. When the application attempts to be ran via the debugger, I receive:
Error while trying to run project: Could not load file or assembly 'MyProjectName' or one of its dependencies. The module was expected to contain an assembly manifest.
Some things I have tried based on other questions and Google:
- Cleaning the solution and rebuilding did not help.
- Renaming the project did not help.
- There are no name collisions in the dependencies and the project.
- Building as AnyCPU works within the debugger but I am specifically trying to use x86
Another thing to note is that the compiled binary runs fine outside of Visual Studio. It just refuses to be debugged within VS. Which does not make sense to me that it will run fine outside of VS without the error, but inside it throws that error with no additional information.
The debug output does not contain any error information that would be at all useful.
Compiling after running Build -> Clean gives:
1>------ Rebuild All started: Project: MyProjectName, Configuration: Debug x86 ------
1> MyProjectName -> <Path Stripped>\MyProjectName.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Attempting to debug the x86 build gives:
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\12.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded '<Path Stripped>\MyProjectName.vshost.exe'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll'
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in Microsoft.VisualStudio.HostingProcess.Utilities.dll
The thread 'vshost.NotifyLoad' (0x15c8) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x29d0) has exited with code 0 (0x0).
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded '<Path Stripped>\MyProjectName.exe', Symbols loaded.
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'Microsoft.Practices.ServiceLocation'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'GalaSoft.MvvmLight.Extras'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXmlLinq.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'GalaSoft.MvvmLight'
A first chance exception of type 'System.IO.FileNotFoundException' occurred in System.dll
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'System.Windows.Interactivity'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'Newtonsoft.Json'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Dynamic\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Dynamic.dll'
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXml\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXml.dll'
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'Xceed.Wpf.Toolkit'
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
A first chance exception of type 'Microsoft.CSharp.RuntimeBinder.RuntimeBinderException' occurred in Microsoft.CSharp.dll
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationTypes\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationTypes.dll'
'MyProjectName.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationProvider\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationProvider.dll'
A first chance exception of type 'System.Net.WebException' occurred in System.dll
The thread 'vshost.RunParkingWindow' (0x31a4) has exited with code 0 (0x0).
The thread '<No Name>' (0x2884) has exited with code 0 (0x0).
The thread '<No Name>' (0x3590) has exited with code 0 (0x0).
The program '[12724] MyProjectName.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
The program '[12724] MyProjectName.vshost.exe: Program Trace' has exited with code 0 (0x0).
There is no useful stack info since there is no breakpoints hit as this dies before my app starts. So I am unsure what module is causing this. Given that it runs fine on disk from whats compiled, I don't think the issue resides in my project but perhaps inside of VS. I have not installed/uninstalled anything on the machine so nothing has changed lately. I am unsure why this just started happening out of nowhere.
Edit
And now AnyCPU is causing the error to appear when it was literally just working as I was typing this.. :(