今天,我克隆从GitHub我的窗户普遍的应用项目,在新机器上运行新安装Visual Studio 2015年。
Today I cloned my windows universal app project from github onto a new machine running a new install of Visual Studio 2015.
该项目加载后,我注意到,所有的我的网页和属性被强调红色许多错误
After the project loaded, I noticed that all of my pages and properties were underlined red with many errors
CS0246 C#中的类型或命名空间名称<名称>找不到(是否缺少using指令或程序集引用?)
,以及其他如
CS0518 C#预定义类型'System.Void没有定义或导入
CS0012 C#的类型''在未引用的程序集的定义。您必须添加到程序集的引用'mscorlib程序,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089'。
CS1545 C#属性,索引器或事件Application.Suspending不被支持的语言;尝试直接调用访问方法Application.add_Suspending(SuspendingEventHandler)'或'Application.remove_Suspending(EventRegistrationToken)
我注意到,CS0012,其实是给予要解决这一问题,需要什么样的信息:
I noted that CS0012 actually gives information about what is needed to address the issue:
您必须添加一个引用到组装'mscorlib程序,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089'。
You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
在看我的project.json文件,但是,我可以看到
Looking in my project.json file, however, I could see
"dependencies": { "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0" }其结果是,项目将无法生成或运行,只是列出了很多错误,你怎么能解决这个问题?
As a result the project will not build or run, just lists lots of errors, how can you fix this?
推荐答案展望在参考在项目的解决方案资源管理器可以看出,即使 Microsoft.NETCore.UniversalWindowsPlatform 被列为依赖关系,它是从项目丢失,这是导致问题
Looking in the References of the project in the Solution Explorer it can be seen that even though Microsoft.NETCore.UniversalWindowsPlatformis listed as a dependency, it's missing from the project and this is causing the issue.
Visual Studio中知道该组件的依赖,需要引用,但它似乎并没有预装与Visual Studio 2015年,甚至当你安装所有的安装在Windows 10的开发工具,它似乎并不甚至自动提取的包时,它知道它需要它!
Visual studio knows that the assembly is a dependency and needs to be referenced but it doesn't seem to come preinstalled with Visual Studio 2015, even when you install all of the Windows 10 development tools during setup, and it doesn't seem to autofetch the package even when it knows it needs it!
要解决,你需要手动安装使用封装的NuGet,这将被作为参考解析正确。
To fix, you need to manually install the package using NuGet and it will then be resolved correctly as a reference.
要做到这一点,右键点击参考 ,然后点击管理的NuGet包... 。
To do this, right click on References, then click Manage NuGet Packages....
在的NuGet包管理器屏幕,搜索 Microsoft.NETCore.UniversalWindowsPlatform ,这将是完全匹配的。
On the NuGet Package Manager screen, search for Microsoft.NETCore.UniversalWindowsPlatform and it will be an exact match.
点击安装在详细信息窗格右侧和Visual Studio将获取包并将其包含在你的项目
Click on Install in the details pane on the right hand side and Visual Studio will fetch the package and include it as a reference in your project
然后红色下划线将全部消失,你可以继续你的项目!
The red underlining will then all disappear and you can continue working on your project!
更多推荐
Visual Studio的2015年
发布评论