This blog is moving to the Microsoft Azure Blog, more specifically in the Mobile area. Please update your links!
Yesterday we launched preview support for a .NET based Mobile Services backend (for more information see here). For this release we’ve focused on the standard right click -> publish workflow in Visual Studio to publish your backend logic to the cloud, but if you’re a git fan fear not! Publishing your .NET based backend with git is actually really easy:
Initialize a git repository in the same directory as your solution:> git init
Add an appropriate .gitignore file to avoid committing binaries to your repository. You can download one from http://www.gitignore.io/api/visualstudio, but be aware you’ll need to make one tweak: find the line with #packages/* and remove the # at the front. Save the .gitignore file in the root of your repository.
Add and commit your files to the repository> git add .> git commit –m "initial commit"
Add your mobile service as a remote (replace <servicename> below with the name of your mobile service):> git remote add origin https://<servicename>.scm.azure-mobile.net/<servicename>.git
Push to your mobile service:> git push origin master
When prompted for credentials, you have a few options (we'll be making this easier in the future):
After providing the credentials, your code will be pushed to your mobile service and a deployment script will use NuGet Package Restore to download all the necessary binaries. You should see some output that looks like this:
remote: KuduSync.NET from: 'C:\DWASFiles\Sites\dotnet\Temp\2295442c-37d2-4d6b-8365-3b047109b840' to: 'D:\home\site\wwwroot'remote: Copying file: 'Web.config'remote: Copying file: 'bin\dotnetService.dll'remote: Finished successfully.remote: Deployment successful.To https://dotnet.scm.azure-mobile.net/dotnet.git+ 3fff290...bfc6c99 master -> master
That’s it! Hit your mobile service and you should see your changes have taken effect.
Of course you can follow similar steps to above using the built in git tooling in Visual Studio 2013, and in future releases you can expect the process of setting up git to become even easier and we'll have support for integration with hosted repositories such as GitHub and Codeplex. Happy hacking!