ServiceStack set up packages - servicestack

I'm trying on ServiceStack but getting stuck in the installation. Can I ask what's the correct packages to install? For a very simple tutorial on Pluralsight.
It doesn't seem to allow me to enable using ServiceStack.Interfaces or using ServiceStack.ServiceInterface in my application. Even though those are right there in the References.
I have installed ServiceStrack, ServiceStack.Host.MVC, ServiceStack.Host.AspNet and more.

Assuming you want to build just minimal web-service, you do not need to install Host.MVC or Host.AspNet, just install the minimal package using NuGet Package Manager like this:
Install-Package ServiceStack
After that you can use this guide to configure your newly ServiceStack Web-Service.

The easiest way to install ServiceStack is with ServiceStackVS VS.NET Extension which will download the right packages for each project type. See this guide on Creating your first project with ServiceStackVS.
If you want to add packages manually to a normal ASP.NET Web Application please see Creating a Service from Scratch.

Related

Can I consume a Nuget package within a Node project?

I am working with Visual Studio 2017. I started from; Basic Node.js Express 4 Application.
I have a private Nuget in VSTS which has a .Net tool I would now like to use in the Node.js project (to perform some domain specific build-like tasks).
Is it possible to add a Nuget reference into a Node.js project (just to download the tool)?
I've seen that VSTS provides npm, but this would seem to be incompatible with my existing Nuget packages.
Is it possible to add a Nuget reference into a Node.js project (just to download the tool)?
I am afraid you can not do that at this moment.
Because Nuget does not currently support the node.js project even if you just download the tool. When you use nuget on the node.js project, we always get the error 'Project "Default" is not found.'. npm is the right solution for package management for node.js project.
See similar issues on GitHub for some more details:
Cannot install packages in Node.js project - Project "Default" is not found
Nuget package manager cannot 'see' Node.JS projects
Hope this helps.

Azure Mobile Services - System.PlatformNotSupportedException

i'm working on a xamarin forms app with azure however when I load my initial page it crashes on the line:
public static MobileServiceClient MobileService =
new MobileServiceClient(
"https://myapp.azurewebsites.net");
with exception:
System.PlatformNotSupportedException "The empty PCL implementation for
Microsoft Azure Mobile Services was loaded. Ensure you have added
nuget package to each of your platform projects."
How do I fix this?
It might mean that the NuGet packages did not install correctly in one of your platforms. I would suggest doing a force-reinstall of all NuGet packages using the Package Manager Console (Tools/NuGet Package Manager/Package Manager Console).
Update-Package -reinstall
Do this for all projects in your solution. Once done, close and reopen Visual Studio, open your solution and click Build in the top menu and do Clean Solution.
Now look into each of your platform projects in turn to see if you have a Microsoft.Azure.Mobile.Client reference there:
If it is not there, install the Microsoft.Azure.Mobile.Client package again in that given project.
Then you should proceed as described in any tutorial on Azure Mobile Services. Even if you use the Shared Project strategy in you Xamarin.Forms app, it should work as expected once the platform project has Microsoft.Azure.Mobile.Client installed.
If it does not help, as the last resort I would suggest trying to update all NuGet packages to their last version (right-click solution, Manage NuGet Packages for Solution...)
Make sure that you add the initialization code in the respective AppDelegate/MainActivity
CurrentPlatform.Init();
And that in the iOS, Android and PCL projects there is the reference to the Microsoft.Azure.Mobile.Client package.
Example
It instantiates the MobileServiceClient in the TodoItemManager class.

Migrate Microsoft.WindowsAzure.Mobile.SQLStore to Microsoft.Azure.Mobile.Client.SQLiteStore

I am trying to update one of my Xamarin.Forms apps that uses the deprecated Microsoft.WindowsAzure.Mobile.SQLStore pacakge with the new Microsoft.Azure.Mobile.Client.SQLiteStore package but I get the following error when I try to install the package in my Core pcl project:
Could not install package 'Microsoft.Azure.Mobile.Client.SQLiteStore 4.0.0'.
You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', 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.
I tried to follow this documentation but they seem to forget to add the code sample, so I can't figure out exacly what they are doing. The deprecated Microsoft.WindowsAzure.Mobile.SQLStore package installed in a PCL library but the new Microsoft.Azure.Mobile.Client.SQLiteStore package doesn't or so it seems.
Any help would be appreciated.
It turns out that Microsoft.Azure.Mobile.Client.SQLiteStore 4.0.0 does not support PCL anymore but they moved to .NET Standard 1.4. PCL support stops at version 3.1.0
So if you are using PCL install v3.1.0. But before you install v3.1.0, make sure you manually remove the deprecated Microsoft.WindowsAzure.Mobile.SQLStore first.
Check out this issue for more details: https://github.com/Azure/azure-mobile-apps-net-client/issues/337
you can try and open the .csproj of your PCL and replace the Profile78 entry with a profile the NuGet package supports (probably Profile259 which includes almost everything but windows phone silverlight)
If your project won't compile after changing your profile (because there are missing type references e.g.) try picking a different profile the package supports.
If you're having multiple PCLs you might need to change the target profile of all of them.
Try Changing .Net profile to Profile 7 and then update.
Go To Cross Platforms Project Options->Build->General->.Net Portable

Trouble adding PCL NuGet package to PCL project with custom profile

So I've been working on a game, and the sheer number of projects has become unmanageable. Enter NuGet.
I wanted to ensure my code would work on different devices, so I've been making these projects as Portable Class Libraries. I needed to use these on XBox, Windows, iOS, Android, and Silverlight. I created some custom custom SupportedFrameworks in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile1\SupportedFrameworks
Specifically MonoAndroid and VSMonoTouch
I successfully turned one of these PCLs into a NuGet package, but when I try to add them to another PCL of the same profile I get this error:
Could not install package 'Framework.dll 1.0.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile1', 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.
The package folder was brought down and contains a folder named: portable-win+net40+MonoAndroid16+sl40+net10+wp+Xbox40 and indeed contains the requested dll. I am able to add this dll to my project manually, so I believe this may be a bug in NuGet. I investigated this online, and found the main fix was to update NuGet, because the newest version plays nicer with PCLs. I've updated, but to no avail.
Has anyone seen this before, or am I missing something obvious? Any help would be greatly appriated =)
Thanks,
Joshua
It looks like you are using ".NETFramework" for the identifier in the XML file you put in the Profile1 SupportedFrameworks folder. This was basically a hack to get iOS projects building on Windows, but with real support for that scenario you should change that identifier to MonoTouch. Then when you create the package it should use monotouch in place of net10 for the lib/portable-x+y+z folder.
Then, as #Deepak suggests, install the nightly build of NuGet. Then you should be able to install the NuGet package into your PCL project. If you do try this, please let me know whether it worked or not. :)

NuGet : How to keep package versions consistent across several solutions?

We're building a set of several services, each service has it's own solution with associated projects. Many of these services rely on the same NuGet packages.
All the solutions have "Package Restore" enabled.
Some of the solutions refer to assemblies owned by other solutions, this is one obvious reason why we need all the solutions to refer to exactly the same versions of different NuGet Packages.
All of the services need to work together to achieve an end result. They're packaged and installed as part of a single product, which is another reason we'd like everything to be running off the same versions of the NuGet Packages
We're having trouble keeping package versions consistent between Solutions.
Currently we're manually checking and updating package versions, we're also getting occasional compilation errors because projects in one solution end up referring to different versions of the same package.
Is there a recommended way of doing this (hopefully an automatic process)?
Would we be better off without Package Restore?
Anyone have any general advice on the subject?
Thanks
Update: I created an issue for this on the NugGet project http://nuget.codeplex.com/workitem/2623
To solve this:
Create your own private NuGet server (see 1 and 2) that hosts the correct versions of the packages you use.
Configure each build system to use that server and auto update to the latest version.
Although this requires a server, it not only ensures everyone has the correct version but speeds up the downloads for build servers as well.
You could configure your TFS builds to update all NuGet packages in the solution to their latest versions using the nuget update command.
The latest versions could be from nuget.org, a local NuGet server or even a network share. Use the source parameter to define the sources you want to update from.
You can perform the build configuration via MsBuild proj files or via a TFS template.

Resources