{"action":"created","issue":{"url":"https://api.github.com/repos/anjdreas/UnitsNet/issues/150","repository_url":"https://api.github.com/repos/anjdreas/UnitsNet","labels_url":"https://api.github.com/repos/anjdreas/UnitsNet/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/anjdreas/UnitsNet/issues/150/comments","events_url":"https://api.github.com/repos/anjdreas/UnitsNet/issues/150/events","html_url":"https://github.com/anjdreas/UnitsNet/issues/150","id":139665191,"number":150,"title":"UnitsNet types are not Windows Runtime Component Compatible","user":{"login":"jbienzms","id":5230670,"avatar_url":"https://avatars.githubusercontent.com/u/5230670?v=3","gravatar_id":"","url":"https://api.github.com/users/jbienzms","html_url":"https://github.com/jbienzms","followers_url":"https://api.github.com/users/jbienzms/followers","following_url":"https://api.github.com/users/jbienzms/following{/other_user}","gists_url":"https://api.github.com/users/jbienzms/gists{/gist_id}","starred_url":"https://api.github.com/users/jbienzms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbienzms/subscriptions","organizations_url":"https://api.github.com/users/jbienzms/orgs","repos_url":"https://api.github.com/users/jbienzms/repos","events_url":"https://api.github.com/users/jbienzms/events{/privacy}","received_events_url":"https://api.github.com/users/jbienzms/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":16,"created_at":"2016-03-09T18:43:14Z","updated_at":"2016-03-23T14:59:07Z","closed_at":null,"body":"I would like to use UnitsNet in a large Windows IoT Core Devices project I manage called [Microsoft.IoT.Devices](http://aka.ms/iotdevices). However, when I attempt to use the types defined in UnitsNet as return values in my library I get the following error:\r\n\r\n> Severity\tCode\tDescription\tProject\tFile\tLine\tSuppression State\r\n> Error\tWME1032\tMethod 'Microsoft.IoT.DeviceCore.Sensors.ITemperatureReading.Temperature.get()' returns 'UnitsNet.Temperature', which is not a valid Windows Runtime type.  Methods exposed to Windows Runtime must return only Windows Runtime types.\tMicrosoft.IoT.DeviceCore\tC:\\Users\\jbienz\\Code\\Microsoft\\IoTDevices\\Lib\\Microsoft.IoT.DeviceCore\\Sensors\\Temperature\\TemperatureReading.cs\t23\tActive\r\n\r\n\r\nThis is due to the [type restrictions on WinRT components](https://msdn.microsoft.com/en-us/library/windows/apps/xaml/br230301.aspx).\r\n\r\nObviously UnitsNet was written as a Class Library and not a WinRT component. And obviously refactoring the library into a WinRT component may require that some features be left off. However, I still feel this would be incredibly valuable to have, especially in the IoT space.\r\n\r\nIf you would like to discuss this more please feel free to reach out to me. com dot microsoft at jbienz, or via github."},"comment":{"url":"https://api.github.com/repos/anjdreas/UnitsNet/issues/comments/200382782","html_url":"https://github.com/anjdreas/UnitsNet/issues/150#issuecomment-200382782","issue_url":"https://api.github.com/repos/anjdreas/UnitsNet/issues/150","id":200382782,"user":{"login":"jbienzms","id":5230670,"avatar_url":"https://avatars.githubusercontent.com/u/5230670?v=3","gravatar_id":"","url":"https://api.github.com/users/jbienzms","html_url":"https://github.com/jbienzms","followers_url":"https://api.github.com/users/jbienzms/followers","following_url":"https://api.github.com/users/jbienzms/following{/other_user}","gists_url":"https://api.github.com/users/jbienzms/gists{/gist_id}","starred_url":"https://api.github.com/users/jbienzms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbienzms/subscriptions","organizations_url":"https://api.github.com/users/jbienzms/orgs","repos_url":"https://api.github.com/users/jbienzms/repos","events_url":"https://api.github.com/users/jbienzms/events{/privacy}","received_events_url":"https://api.github.com/users/jbienzms/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T14:59:07Z","updated_at":"2016-03-23T14:59:07Z","body":"> Nuget description\r\n\r\nBeautiful! Only a very minor suggestion: instead of (JavaScript and C++) perhaps (**including** JavaScript and C++)? When I read it I just felt it was saying only those languages were supported. Who knows if other languages will be supported in the future and of course C# and VB are already other options today.\r\n\r\n> Type aliasing\r\n\r\nUnderstood. Thank you for re-checking just to be safe.\r\n\r\n> Tests - right off the bat I'm hitting bugs due to ToString() parameter being string instead of CultureInfo\r\n\r\nUh oh. That's honestly kind of unexpected. Can you share what your test code is, what the expected result was and the actual result? I'll see if I can explain why, make suggestions or dig into it more.\r\n\r\n> Can't install nuget on JS app\r\n\r\nFirst and foremost, make sure you've selected a CPU architecture from the solution dropdown. I've noticed NuGet can get wonky if the application project type is set to Any CPU. , can you verify that you did Blank App Universal and not Blank App Universal 8.1?\r\n\r\nWith x86 selected, when I try to reference your NuGet package I get the following error in the Error window:\r\n\r\nCould not install package 'UnitsNet.WindowsRuntimeComponent 3.30.0-alpha3'. You are trying to install this package into a project that targets 'Windows,Version=v0.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.\r\n\r\nI believe the problem is somewhere in your .nuspec file. For example, it's worth noting that your .nuspec lists the following dependencies:\r\n\r\n```\r\n<dependencies>\r\n\t<group targetFramework=\".NETPortable0.0-sl4+wp71+win8\" />\r\n\t<group targetFramework=\".NETPortable0.0-net40+win8+wp8+sl5\" />\r\n\t<group targetFramework=\".NETPortable0.0-net45+win8+wp8\" />\r\n\t<group targetFramework=\"WindowsPhone8.0\" />\r\n\t<group targetFramework=\"Windows8.0\" />\r\n\t<group targetFramework=\"Windows8.1\" />\r\n\t<group targetFramework=\"Unsupported0.0\" />\r\n\t<group targetFramework=\".NETPortable0.0-win81+wpa81\" />\r\n</dependencies>\r\n\r\n```\r\nMy Runtime Component package the only other dependencies listed are other Runtime Component packages I depend on:\r\n\r\n```\r\n<dependencies>\r\n\t<dependency id=\"Microsoft.IoT.DeviceCore\" version=\"1.0.3\" />\r\n\t<dependency id=\"Microsoft.IoT.DeviceHelpers\" version=\"1.0.3\" />\r\n</dependencies>\r\n\r\n```\r\n\r\nI don't have any group or targetFramework elements, but I could be doing it wrong. At the very least I think you at least need to add a targetFramework for uap10.0 to your dependency list.\r\n\r\nHere's a good article on NuGet 3.1 and UWP support:\r\n\r\nhttp://blog.nuget.org/20150729/Introducing-nuget-uwp.html\r\n\r\nThat's where I found that targetFramework string.\r\n\r\nThe only other difference between our nuspec files is you have a language tag and I don't. But I doubt that matters."}}