I submitted an issue for this but it's possible that I've just missed a configuration/setup option somewhere....
My setup is
Windows 8.1 Update 1 running in VMWare
Visual Studio Pro 2012
I have a solution project structure as follows
Player - C# / XAML UI (StartUp Project of app)
PlayerControl - C# background processes/server comms
Library1 - C++ lib
For initial testing of the GA SDK I used nuget to add it to the Player project. This worked perfectly and I could see my app's real-time analytics in the google dashboard.
To better fit the architecture of my app I wanted to move the GA SDK into PlayerControl project (not the StartupProject).
I removed the GA SDK from Player project using nuget, started from a fresh repo/checkout, and added the GA SDK to PlayerControl project using nuget.
Then, when I ran the app I got a System.Aggregate (making it difficult to find the root exception) "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)" when it hit any line that called GoogleAnalytics.EasyTracker.GetTracker().XXX
I finally tracked this down using Process Monitor which contained the following:
QueryDirectory xxx\Player\bin\x86\Release\AppX\analytics.xml NO SUCH FILE Filter: analytics.xml
CreateFile xxx\Player\bin\x86\Release\AppX\analytics.xml NAME NOT FOUND
So, my app was only looking in the startup project's AppX folder for the analytics.xml file whereas the file was actually in the PlayerControl's AppX folder.
To workaround this issue, I copied the analytics.xml to my startup project Player and then I was able to successfully send analytics to google again.
Is this expected behaviour? Does the GA SDK only work correctly when it is added to the StartupProject in a multi-project solution?
Is there a better way to resolve this than my fairly-hacky workaround?
Apr 26, 2014 at 6:46 PM
Great question. By default the config file is loaded from the path: ms-appx:///analytics.xml. However, you can specify a different path via:
GoogleAnalytics.EasyTracker.Current.ConfigPath = new Uri("ms-appx:///myassembly/analytics.xml");
Just make sure you call this code before trying to log any events.
Your suggestion works perfectly!
It would be good if you could add this information to the documentation section to help other people in the same boat (config) as me.