我的程序通过 NuGet 合并了 MVVM Light 的副本。直到大约 5 分钟前,它都可以顺利运行,但现在我收到一条错误消息,提示“RelayCommand.cs 未找到”。由于我从 NuGet 获取了包,因此我没有 RelayCommand.cs 本身,只有 dll。我尝试卸载并重新安装 MVVM Light,但问题仍然存在。现在我真的很茫然。如果有人可以帮助我解决这个问题,以便我可以继续工作,我将不胜感激。
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'.
更新:此时我认为这是 VS 的问题。我手动下载了 dll 文件并引用它们,但仍然遇到相同的错误。我认为创建一个新项目并迁移我的数据可能是值得的。不过,如果有人对如何解决这个问题有任何想法,我会洗耳恭听。
更新:我不知道这是否是问题所在,但该程序似乎正在寻找 MvvmLight (NET35)。我获得的版本(到目前为止一直在工作)是 WPF45。
更新:当我在解决方案中打开 packages.config
时,我收到一条警告,提示“未声明 'packages' 元素”。这可能相关吗?
最佳答案
在 Galasoft 上遇到了同样的问题,并找到了您的帖子。 - 终于我弄清楚了,或者至少不再弹出错误:
转到工具-选项...-调试-常规
并勾选仅启用我的代码
,错误消失了。我假设 MVVM-Light 是在 Debug模式下编译的,现在 Visual Studio 会查找 MvvmLight pdb 和 cs 文件,通过 nuget 安装时当然不存在这些文件。
关于visual-studio - 通过 NuGet 获取的 MVVM Light - 未找到 RelayCommand.cs,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16901736/