This project has moved and is read-only. For the latest updates, please go here.

JavaScript metro app - referencing SDK or winmd?

Sep 2, 2013 at 1:27 AM
For JavaScript app - what's the difference between installing vsix + referencing GA SDK and installing via Nuget + referencing winmd file?
Sep 2, 2013 at 1:59 AM
The vsix installs a 100% native version (written in C++). The NuGet package is 100% managed (written in C#). While the C# version will work just fine in JS apps, the native version is recommended for JavaScript apps because it removes the dependency on the CLR (Common Language Runtime) and therefore will result in slightly better performance, lower memory usage, and better battery life for apps.

The 2 are nearly identical in API and features. The main difference feature wise is that you need to configure the native version in code whereas the managed version offers the additional option of supplying configuration settings via an xml file. Note: the getting started guides in the documentation section explain how to configure either version.

Let me know if you have additional questions!
Sep 2, 2013 at 6:02 PM
My concern is that using native version doesn't support Any CPU, while my JS app works on all platforms. Nuget package doesn't seem to have this problem, right?
Here is the error I get when using Any CPU with native version:

Error 15 The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "GoogleAnalyticsSDK, Version=". Please consider changing the targeted processor architecture of your project (in visual studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM". C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1728 5 *******
Sep 2, 2013 at 6:46 PM
This is correct, but is also expected. Anytime you add a reference to a native WinRT component in your project, you need to change your build configuration to the appropriate architecture of your dev machine to debug (note: I recently updated the getting started guide for JavaScript to indicate this). Then, when it is time to create your app package to submit to the store, you just need to check the box for all 3 architectures (ARM, x86, & x64) in the wizard. When you do this, 3 versions of your app are actually built but packaged into a single .appxupload file. When the end-user downloads your app, the store automatically figures out which one to send to the user depending on what machine they have. This way, users don't end up downloading all 3.

My personal opinion: I wish Visual Studio hid this from the developer to make it simpler but I guess you can't have everything you want right!? :) Also, you're welcome to use the managed (NuGet) version instead if this bothers you but just realize that you're making a slight sacrifice of the user's experience in favor of the developer's experience.
Dec 21, 2014 at 10:04 AM
Edited Dec 22, 2014 at 7:07 AM
Hi, I'm developing a javascript + html app and would like to use Google Analytics. I followed the instructions in [] and the above discussion and everything work well, but when I run the Windows App Certification Kit (3.4) I failed on the supported API test - with many messages like this: API ??0ChangedStateException@Platform@@QE$AAA@XZ in vccorlib120_app.dll is not supported for this application type. GoogleAnalytics.Native.dll calls this API.

(Using an API that is not part of the Windows SDK for Windows Store apps violates the Windows Store certification requirements.)

I didn't try to upload it to the Windows store.
Do you know how to overcome this issue and use the Google Analytics in the store apps?