Archived Forum Post

Index of archived forum posts

Question:

Runtime type is not registered

Nov 03 '15 at 08:42

Im using VS 2015 and following the example here https://www.chilkatsoft.com/downloads_WinRT.asp to use the chilkat ftp2 component in a C#/XAML store app. I copied out the dll and winmd file into a libs directory in my project and added a reference. I also add the VC++ runtime reference. My project compiles fine, but when I access the Chilkat.FTP2 object I get an error "Requested Windows Runtime type 'Chilkat.Ftp2' is not registered."

What am I doing wrong?


Answer

Okay, found my own solution. The issue is that C# winrt app expects a single winmd, which contains both the specification and implementation or a dll with an xml sdk. The solution to use the C++ winmd and dll was to correct the reference in my project file manually. I wish chilkat created an NuGet package for winrt (only win32 exists). If I get time I will try to create.

When adding the reference, visual studio leaves out the following

<iswinmdfile>true</iswinmdfile> <implementation>Chilkat.Windows.dll</implementation>

First, add both winmd, dll to project. Add reference under references. Open csproj file up with notepad. Search for chilkat. change

<reference include="Chilkat, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL"> <specificversion>False</specificversion> <hintpath>LibsChilkat.WinRTChilkat.winmd</hintpath> </reference>

to

<reference include="Chilkat, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL"> <specificversion>False</specificversion> <hintpath>LibsChilkat.WinRTChilkat.winmd</hintpath> <iswinmdfile>true</iswinmdfile> <implementation>Chilkat.Windows.dll</implementation> </reference>

This link is where I found the workaround... http://fixall.online/a-winrt-component-built-with-c-or-vb-produces-a-winmd/725444/