Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 769
Tarks Avatar asked Mar 10 '12 22:03

Tarks


People also ask

What is call by reference in C++?

The call by reference method of passing arguments to a function copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call.

How do you create a reference in C++?

Creating References in C++. Think of a variable name as a label attached to the variable's location in memory. You can then think of a reference as a second label attached to that memory location. Therefore, you can access the contents of the variable through either the original variable name or the reference.

How do you pass a value by reference in C++?

To pass a value by reference, argument pointers are passed to the functions just like any other value. So accordingly you need to declare the function parameters as pointer types as in the following function swap (), which exchanges the values of the two integer variables pointed to, by their arguments.

Is it possible to use C++ references in C?

While C does not support reference data types, you can still simulate passing-by-reference by explicitly passing pointer values, as in your example. The C++ reference data type is less powerful but considered safer than the pointer type inherited from C. This would be your example, adapted to use C++ references:


1 Answers

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.

like image 165
Paul Mendoza Avatar answered Sep 27 '22 18:09

Paul Mendoza