新的生成配置生成运行时错误:无法加载系统运行时



我有一个带有 .Net Framework 4.5.2 控制台应用程序的解决方案,该应用程序依赖于 .网络标准 1.1 库。 控制台应用程序和库都可以完美编译和运行。

我的问题始于我创建一个新的构建配置,我称之为"LocalDebug"并从"调试"配置中复制。 使用新配置,它可以构建正常,但是当我运行它时,当我从类库中访问对象时,它会崩溃,并出现以下异常:

System.IO.FileNotFoundException: Could not load file or assembly 
'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 
or one of its dependencies. The system cannot find the file specified. ---> 
System.IO.FileNotFoundException: Could not load file or assembly 
'System.Runtime, Version=4.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 
The system cannot find the file specified.

我尝试关闭Visual Studio,删除所有中间文件夹和.vs文件夹并重新编译,但没有运气。 我尝试在控制台应用程序中添加 System.Runtime 引用,但它甚至没有显示为选项。 无论如何,这不应该失败,因为我从"调试"中复制了配置,它工作得很好。 什么鬼???

我从来没有弄清楚出了什么问题。 最终调试版本也停止了编译,所以我从轨道上删除了站点,重新创建每个项目并添加代码文件,确保它在每一步都构建。据我所知,我认为我的问题始于我错误地将金块包应用于错误的项目。

最新更新