Link to home
Start Free TrialLog in
Avatar of eelou
eelou

asked on

How to correct Visual Studio 2013, Universal App, NuGet problem

Visual Studio 2013, C#.  I have created a Universal app. Using NuGet, I want to add "NTS Topology Suite".  When I do the search for the package, at the Solution level, it does not find it, the same thing when searching to add to the 'Windows 8.1 Phone" project. It does find it and successfully adds it, for the 'Windows 8.1' project in the Universal solution. I added the ' Using' statement in a class in the Shared project, but when building, it asks me if I am missing a using statement, or a reference. What is this saying ? Is this a matter of the NTS package being compatible only with desktop applications and thus even thought it does allow to be installed to the references in the "windows 8.1' project, it is not really applicable in universal apps?   In a new solution, if I create a Phone project only, it does not find the NuGet package.    If I create a new solution for a "windows 8.1" (not phone\not universal), it does find it.
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

A universal app is designed to be run on the phone and the desktop .. NTS should not be in the shared area since it is not common to both the phone and the desktop .. ensure that the reference is in the right area.. in the desktop but not the phone and use the #if WINDOWS_APP
            NTS code
#endif
#if WINDOWS_PHONE_APP
            NTS replacement code
#endif
Avatar of eelou
eelou

ASKER

I am fairly new to this, so I need to ask some more questions.  What tells me (where do I look to determine), that NTS is not for the phone?  Being able to add the NTS package to a project in a Universal app\solution, is that not an indicator that it can be used for both desktop and phone?  Also, the #If code that you showed, used where, can you point to an example?
#if WINDOWS_APP
                if (!rootFrame.Navigate(typeof(HubPage)))
#endif
#if WINDOWS_PHONE_APP
                if (!rootFrame.Navigate(typeof(WindowsPhoneStartPage)))
#endif
                {
                    throw new Exception("Failed to create initial page");
                }


Windows Dev Center https://msdn.microsoft.com/en-us/library/windows/apps/dn609832.aspx
Avatar of eelou

ASKER

Ok, I understand the #if.  I still need the questions about how to determine if a NuGet package can be used in both the desktop and phone projects of a Universal app.  And, why create a package for only one of them.
Avatar of eelou

ASKER

My original question is not answered (or if it is, I do not understand the answer).  Or maybe I asked the question incorrectly.  I want to share the same code between both projects in the Universal solution. This project was originally  a VS 2008 project that used SQL Server, that I am converting over to a  Win 8.1 store application.  You cannot put SQL Server on a phone app, so someone pointed me to  the NTS Topology Suite.  I want to be able to draw a polygon and calculate acreage.  In a Universal application, I can add the "NTS Topology Suite" NuGet package to a "Windows 8.1" project, but not to a "Windows Phone 8.1" project (I right click on the phone project, manage NuGet Packages, search for NTS Topology Suite, it does not find it).    Do I either need to find something that works on both of the Universal projects (and in which case...I have no idea what that is), do I need to download the source and add it to the phone project (not clear on how to do this either)...or what?   Even if I create two solutions (one windows, one windows phone), I still need to find a package that will do what I want (polygon, etc.), in Windows store 8.1.  Thanks.
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eelou

ASKER

Primarily, or, only ?

Is this the way with all Phone providers (Apple, Android, etc.)
It has more to do with the limitations of the device. Limited compute capability, memory, storage space and speed and api's.  Windows phone has a reduced .net framework. One has to program around the limitations and if you need more then you offload the restrictions to a server and use its capabilities and then only use the device as an i/o item.