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# 类库?
基础教程推荐
- 获取C#保存对话框的文件路径 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 将数据集转换为列表 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 如果条件可以为空 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
