How do you reference a C# class library from a Win8 Javascript metro application?(如何从 Win8 Javascript Metro 应用程序中引用 C# 类库?)
问题描述
当我尝试标准方式时,它抱怨引用不受支持,我似乎无法使用我的任何类.
When I try the standard way it complains of an unsupported reference and I can't seem to use any of my classes.
推荐答案
您需要通过Visual C#"->Windows Metro Style"->类库"模板创建类库来创建 Windows 运行时组件.然后在该类库项目的属性中,您需要将输出类型标记为WinMD 文件"
You need to create a Windows Runtime component by creating a class library from the "Visual C#" -> "Windows Metro Style" -> "Class Library" template. Then in the properties for that class library project you need to mark the output type as "WinMD File"
可以在这里找到更好的说明:
Better instructions can be found here:
http://msdn.microsoft.com/en-us/library/windows/apps/hh779077(v=vs.110).aspx
这在文档中没有说明,可能只是 Windows 8 Consumer Preview 和 Visual Studio 11 Beta 的一个错误,但请确保不要在您引用的项目名称中包含句点.例如,我正在开发一个 Car 应用程序,所以我制作了一个名为Car.Business"的程序集.每当我尝试引用它时,应用程序总是会崩溃并出现空白启动屏幕.另一方面,如果我只是使用Business"作为程序集的名称,那么该应用程序可以正常工作.
This isn't stated in the documentation and is probably just a bug with the Windows 8 Consumer Preview and the Visual Studio 11 Beta but be sure not to include a period in the name of the project you're referencing. For instance, I was working on a Car application so I made an assembly named "Car.Business". The application would always crash with a blank startup screen whenever I tried to reference this. If on the other hand I just used "Business" as the name of the assembly then the application would work fine.
这篇关于如何从 Win8 Javascript Metro 应用程序中引用 C# 类库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何从 Win8 Javascript Metro 应用程序中引用 C# 类库?
基础教程推荐
- rabbitmq 的 REST API 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01