Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use a dll compiled with .Net Framework 4.0in a Windows Metro App

I am new to Windows 8 app development and professional C# dev. I have run into a problem where a client wants me to interface with a printer (DYMO 450 Turbo) and the SDK only comes with a dll that has been compiled using .net 4.0 . The samples show referencing the dll from the app which I can not do because the app is written in Javascript using WinJS. The metro apps use NETCore where the dll uses NETFramework. My best solution so far is to write the code to interface with the printer as a server in .NET 4.0 that listens for requests sent from Javascript over XMLHttpRequest. My gut tells me there HAS to be a better way, but either Ihavn't figured it out or maybe I just don't know enough to figure it out yet. Any help would be appreciated. Thanks in advance.

like image 681
Tyler Mitchell Avatar asked Nov 28 '25 12:11

Tyler Mitchell


1 Answers

You cannot use a standard .NET 4.0 assembly in a Windows Store app. You can only use WinRT components. That said, your existing component may or may not be easy to convert to a WinRT componenet. If you simply include the project for your .NET 4.0 component and then change the Output Type (under the project properties) to Windows Runtime Component, you can have a look at all of the compiler errors that are thrown and get an idea of how big of a chore it's going to be to convert it. This article will let you know what the restrictions are on WinRT components.

like image 94
Jeremy Foster Avatar answered Dec 01 '25 01:12

Jeremy Foster