Deploying netcore web apps using ARM - .net-core

I'm building a selection of servers with .Net core 1.1 that are grouped together in an environment and I use an ARM template to create the various Azure resources I need. Currently however I have to manually deploy the actual servers, rather than having ARM deploy the artefacts for me as I'd like.
The instructions here don't work for netcore apps, but it feels like with the move to msbuild for netcore 1.1 I should be able to do this.
I've tried searching the quickstart ARM template repository, but can't find anything relevant.
The biggest stumbling block seems to be that "Web Deploy for Web Apps" needs a zip file, but dotnet.exe doesn't produce one.

you can zip the output of "dotnet publish" and use this .zip file for the deployment.
Make sure there is no root folder in the .zip. For example:
publish.zip
- bunch of .dll files
- wwwroot
- Views
...
I hope this will help you,
KirK

Related

Elastic Beanstalk AWS ebextensions Windows ASP.net private bin files best practices

Deploying a ASP.NET web app to Elastic Beanstalk. Trying to find the proper way to deploy the app from Visual Studio using the AWS extensions. I've read up on the AWS ebextensions config files but I've also seen something on SO that there's quirks with ebextension files and Windows deployments. What I want to do is deploy my web app which relies on many private .NET dlls that need to go in the web site's bin folder. Right now I reference them directly from the project itself and mark them as 'Content' and 'Copy If Newer' in VS. Wondering if the better alternative is to package up these bin files, upload them to S3 and use the ebextensions to get them installed as part of the deployment process for an EB app. I'm struggling with how to properly do the latter idea. Any ideas on best practices for this case?
You cannot. The dependencies required for any application should be included in deployment package.
I'd suggest you to adapt best practices and get rid of the DLL's included in your project folder. You can create packages for your dependencies and reference them from any other project. Take a look here. This way you can prevent duplicate dll's in deployment package.

Adding grunt output directory to ASP.NET web service

I am creating a javascript webApp and i deploy it using GruntJS. this web app will be deployed in an ASP.NET MVC Web Service. I want to add the dist folder (and any files created by grunt inside the folder) programmatically inside the visual studio project, so when I build and deploy the web service I can navigate to this folder. Hope I was clear!
Yes you can. Grunt is completely independent of IDEs and texteditors and is a really helpful tool for all kinds of web development in any editor.
Grunt is described as “a node based javascript task runner with which you can automate tasks like minification, compilation, unit testing, linting and more”. You can use it for example when you do not like to be dependent on an asp.net web server doing minification and bundling for you, or you simply like to be able to use tools that are not (yet) supported by the asp.net/Visual Studio ecosystem.
Here is all you need: http://joeriks.com/2013/08/06/can-i-benefit-from-grunt-for-my-visual-studio-based-web-development/
Hope this helps!
Try to tweak WebDeploy settings in your MSBuild file (*.csproj?) so it would include files from the dist folder into your web application during publishing.
The following tutorial should be a good starting point how to do it:
http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files
Also check ASP.NET Solution Template on Visual Studio Gallery

Deploying only modified files with TeamCity?

I have an ASP.NET web site - aka, I don't need to build the project and deploy dlls along with the project, I just place the .aspx and .aspx.cs files on my web server and things are compiled automatically.
I would like to setup TeamCity as a continuous integration server for this project so that it will only deploy the files that were checked in rather than updating every file in the project when I leave a specifically formatted comment during checkin.
So far I was able to setup a build trigger that only fires if the comment is formatted correctly, but I can't find a way to tell TeamCity to only deploy the files that have been checked in rather than the entire project.
Can this be done? If so, can someone point me in the right direction?
I would use Microsoft's WebDeploy. It will automatically deploy only the files that have changed.
Troy Hunt's guide to setting up build and deployment in Team City along with WebDeploy is an excellent place to start:
http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html
Also, if you prefer a more manual approach, you could use RoboCopy to do a sync:
http://itbloggertips.com/2013/05/robocopy-command-copy-only-new-changed-files-sync-both-the-drive/

Classic asp - How to automate deployment - in continuous integration environment

I've been doing some reading http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html and https://michaelbaylon.wordpress.com/2011/04/13/managing-sql-scripts-and-continuous-integration/ ... etc on automated deployment and continuous integration etc but non of it seems to talk about automated deployment in a classic asp environment and you can't really do proper CI unless you get into automated deployment.
Can MSDeploy deploy a classic asp website? If not ... is it best to just write a build script that copies all the files over to the correct folder and then start up IIS? I've done this using msbuild and the robocopy msbuild extension task. But then how do you handle the different environments (QA, dev, staging, production) there's no web config to put the different connection strings etc ... supposedly msbuild is configuration aware ... but how does that work when there is no web config?
So with all these questions I'm struggling to really move forward with creating a deployment script / module / exe for our classic asp website. Does anyone have any answers / resources / further questions that they can point me in the direction of?
Web Deploy (http://www.iis.net/download/WebDeploy) is the way to go. You just have to customize the deployment script for different environments.
You might find this links helpful:- http://msdn.microsoft.com/en-us/library/ms241740.aspx- "Build" Classic ASP with TFS 2010
MSDEPLOY can deploy anything that can live in IIS. You can create a package from the existing web site, and examine it to see what got packaged. You should be able to use that to determine how to package up your site from sources.
You should even be able to create a Visual Studio project from your sources so that you can use the Web Publishing Pipeline directly. The fact that there is nothing there to compile shouldn't stop you from specifying that your .ASP files are content files.
Checkout using cruisecontrol.net, we use that for our automated deploys along with msbuild and it works great. We are a .Net shop but it's basically the same thing. Cruise Control can run scripts and does handle the web.config / global.asa transformations pretty good. As long as you can script it cruise control could handle it.
Depending on your development environment you might be able to hook it into cruisecontrol. We use TFS and it integrates nicely so when we check items into our different branches (Dev, Main, Stage) it auto deploys the site to the appropriate location.
Deploying to our production environment we use MSbuild to move the code. Since it's in another network location we needed something that could go outside and do any server updates necessary.
http://cruisecontrol.sourceforge.net/

ASP.NET Web Application Build Output - How do I include all deployment files?

When I build my ASP.NET web application I get a .dll file with the code for the website in it (which is great) but the website also needs all the .aspx files and friends, and these need to be placed in the correct directory structure. How can I get this all in one directory as the result of each build? Trying to pick the right files out of the source directory is a pain.
The end result should be xcopy deployable.
Update: I don't want to have to manually use the Publish command which I'm aware of. I want the full set of files required by the application to be the build output - this means I also get the full set of files in one place from running MSBuild.
One solution appears to be Web Deployment Projects (WDPs), an add-on for Visual Studio (and msbuild) available that builds a web project to a directory and can optionally merge assemblies and alter the web.config file. The output of building a WDP is all the files necessary to deploy the site in one directory.
More information about Web Deployment Projects:
Announcement on webdevtools MSDN blog for WDP 2008
ScottGu introduction to WDP 2005
The only disadvantage to this solution is the requirement on an add-on which must be available on the build machine. Still, it's good enough for now!
ASP.NET doesn't have real xcopy deployment for new sites. It depends on having a virtual directory/Application in IIS. However, once that virtual directory is created you can use xcopy for updates.
You can Publish Web site..If you want to automate your deployment, you need to use some script.
Have you tried using the aspnet_compiler.exe in your .net framework directory? I'm pretty sure you can create a "deploy ready" version of a web application or web site.
The _CopyWebApplication target on MSBuild will do exactly what you need. The catch is that only the main assembly will be copied to the bin folder and that's why a copy task is needed to also copy any other file on the bin folder.
I was trying to post the sample script as part of this post but wasn't able to.
Please take a look at this article on my blog that describes how to create a MSBuild script similar to the one you need.
Have you tried right clicking the website in Solution Explorer and clicking 'Publish Website'?
Build --> Publish
A dialog box will appear that will guide you through the process.
For the automated building you describe in the update, I would recommend you look into MSBuild and CruiseControl.NET
It depends on how complicated solution you need, you could just use a script and jenkins for example. You can use MSBUild with Jenkins for just deploying to an IIS. And if you got Jenkins other tools is pretty easy to connect into it later on. But if you just want to build, use a script that jenins execute every build that uses MSDeploy and it will work great.
This is how i do it, just to give you a feeling:
Sonarqube uses Gallio, Gendarme, FXcop, Stylecop, NDepths and PartCover to get your metrics and all this is pretty straight forward since SonarQube do this automatically without much configuration.
Here is Jenkins witch builds and get Sonar metrics and a another job for deploying automatically to IIS. I use a simple script one line that calls my MSBuild and wich URL, pass and user.
And Sonarqube, all metrics for my project. This is a simple MVC4 app, but it works great!:
If you want more information can i provide you with a good guide.
This whole setup uses MSBuild, too build and deploy the apps.

Resources