今天,我将我的 Windows 通用应用程序项目从 github 克隆到运行新安装的 Visual Studio 2015 的新计算机上。
项目加载后,我注意到我的所有页面和属性都带有红色下划线,并且有许多错误
CS0246 C# The type or namespace name "<name>" could not be found (are you missing a using directive or an assembly reference?)
以及其他诸如
CS0518 C# Predefined type 'System.Void' is not defined or imported
CS0012 C# The type '' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
CS1545 C# Property, indexer, or event 'Application.Suspending' is not supported by the language; try directly calling accessor methods 'Application.add_Suspending(SuspendingEventHandler)' or 'Application.remove_Suspending(EventRegistrationToken)'
我注意到 CS0012 实际上提供了有关解决该问题所需的信息:
您必须添加对程序集“mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”的引用。
但是,查看我的 project.json 文件,我可以看到
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
}
因此,该项目将无法构建或运行,只会列出很多错误,您该如何解决这个问题?