How do you reference a C# class library from a Win8 Javascript metro application?

后端 未结 1 1238
青春惊慌失措
青春惊慌失措 2021-01-18 04:00

When I try the standard way it complains of an unsupported reference and I can\'t seem to use any of my classes.

相关标签:
1条回答
  • 2021-01-18 04:37

    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

    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.

    0 讨论(0)
提交回复
热议问题