2

My program incorporates a copy of MVVM Light via NuGet. Up until about 5 minutes ago it worked without a hitch, but now I'm getting an error saying "RelayCommand.cs not found". Since I got the package from NuGet, I don't have RelayCommand.cs itself, just the dll. I have tried uninstalling and reinstalling MVVM Light and the problem persists. Right now I really am at a loss. If anybody could help me fix this so that I can continue working I would greatly appreciate it.

Locating source for 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs'. Checksum: MD5 {9c e1 3c 59 78 15 34 23 2b e 9b 39 ef 5d eb d0}
The file 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs' does not exist.
Looking in script documents for 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs'...
Looking in the projects for 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs'.
The file was not found in a project.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: d:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs.
The debugger could not locate the source file 'd:\GalaSoft\mydotnet\MvvmLight\Source\GalaSoft.MvvmLight\GalaSoft.MvvmLight (NET35)\Command\RelayCommand.cs'.

Update: At this point I'm thinking that this is a problem with VS. I downloaded the dll files manually and referenced them and I'm still getting the same error. I'm thinking it might just be worth it to make a new project and migrate my data. If anybody has any ideas on how to fix this, though, I'm all ears.

Update: I don't know if this could be the issue, but it appears that the program is looking for MvvmLight (NET35). The version I obtained (and had working up until now) is WPF45.

Update: When I open packages.config in my solution, I get a warning that says "The 'packages' element is not declared." Could this be relevant?

Jason D
  • 2,634
  • 6
  • 33
  • 67
  • Did the error occur after an update from Nuget? If so, revert back to the previous assemblies. Did the error just suddenly appear, re: no other new dependencies (references) were added to the project, then clean the solution (right click solution > clean solution) and then rebuild. Still fails? Start with a fresh solution and start adding the bits one by one and building along the way until you find the failure point. – Metro Smurf Jun 03 '13 at 18:16
  • The error happened while I was working on a bit of code that didn't have anything to do with RelayCommand. To my knowledge, NuGet didn't update anything (all I had downloaded was MVVM Light). I tried cleaning and rebuilding the solution with no luck. I'll try a fresh solution. – Jason D Jun 03 '13 at 18:20

3 Answers3

4

Got just the same Problem with Galasoft and found your post. - Finally I figured it out, or at least the error no longer pops up:

Go to Tools-Options...-Debugging-General and tick Enable Just My Code and the error disappeared. I assume MVVM-Light is compiled in Debug Mode and now Visual Studio Looks for the MvvmLight pdb and cs file which are of course not there when installed via nuget.

Rolfi
  • 452
  • 5
  • 13
0

I don't know why this would cause such an error, but I believe it was caused by trying to read in data from a file that didn't exist. I removed that code and the error went away.

Jason D
  • 2,634
  • 6
  • 33
  • 67
0

When I got this error it was because of an invalid cast exception. I had this:

MyCommand = new RelayCommand<int>((i) => MyMethod(i));

But the property I was Binding in my XAML was a long. I changed it to this and it worked:

MyCommand = new RelayCommand<long>((i) => MyMethod(i));
xenteros
  • 15,586
  • 12
  • 56
  • 91
  • It's a very misleading error because the first message displayed references a file on the D:\ drive. I don't keep anything on my D:\ drive and I don't know why it would look there, but it made me think a file really was missing. But if you click for more detail, it says there's an invalidcastexception in that file and referenced a line number. How did it find the line number in a file that doesn't exist? Hmmmm...... – TheStevenP Sep 07 '16 at 18:52
  • please elaborate your question so that you can get good answers-reviews – Ravi Teja Kumar Isetty Sep 07 '16 at 18:55