你如何从Win8中的Javascript Metro应用中引用一个C#类库? [英] How do you reference a C# class library from a Win8 Javascript metro application?

查看:117
本文介绍了你如何从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 Runtime组件 - >的Windows Metro风格 - >类库模板。然后在该类库项目的属性,你需要标记的输出类型为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消费者预览版和Visual Studio 11 Beta版的bug,但一定不要包括你引用项目的名称一段时间。举例来说,我的工作在汽车应用,因此我做了一个名为Car.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#类库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆