Deploy ASP.net/React project with webpack directly from GIT on IIS - c#

The goal is to automatically deploy a ASP.net project from GIT.
The solution (in the Visual Studio sense) consists of multiple projects, using C# and entity framework under the hood and React for the frontend. I know what to install (e.g. with npm) to get the UI transpiled (with webpack), but I am not sure what Visual Studio exactly does when you click on Publish to folder. I would like to do exactly that build step both for the C# backend and the React frontend using a Jenkins server.
I am also dreaming of GIT-tag-triggered builds, but that's a different question.
In summary, I have the following servers running on different (virtual) boxes:
GIT server
Jenkins server
Production server hosting the solution with Internet Information Services (IIS).
I know how to make (1) and (2) talk with each other, and I am able to deploy stuff from (2) to (3). The first part of my challenge is: What do I need to install on the Jenkins server (2) in order to build the complete solution?
Related questions
How can I compile and run c# program without using visual studio?
Sayed Ibrahim Hashimi and Rick Anderson: Visual Studio publish profiles for ASP.NET Core app deployment

Related

How to publish an asp web application in IIS with setup project installer in visual studio

I developed an asp.net web application, I would like to generate an installer which could deploy this application in IIS automatically (or manually with published website code). I've tried to publish the code manually by myself and add them into setup project, but there always gives me an error message. I wonder if there is a way to generate an installer which could deploy my application on IIS.
Here are steps you can take.
1) Take a look at the following link which gives a plugin if you are using visual studio 2015,21017 or 2019. I think this plugin will work even with Community edition.
https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects
2) Once the plugin is installed the following link from microsoft can guide you how you can do the setup at high level.
https://learn.microsoft.com/en-us/biztalk/core/how-to-create-a-web-setup-for-your-published-web-service
Hope this helps.

Runnings tests in visual studio after publish profile finishes successfully

I have an ASP.NET Core project in Visual Studio 2015 that contains a number of publish profiles to deploy my website to various IIS web servers on an intranet. I also have a project containing a set of Selenium tests. Both of these projects are part of the same solution. I want these tests to run on a specified web server if a publish profile finishes successfully. The closest I have got to this is enabling 'Run Tests After Build' in Visual Studio which runs the tests when the project is built manually but doesn't seem to be linked to the pubish profiles finishing.
I don't have access to Team Foundation Server which I beleive is one way to acheive what I want so I was wondering if there were any other solutions, possibly through explicitely running the tests through PowerShell.

How to Deploy C# .net application with MongoDB

I am new to mongoDB. I would like to ask for help about deployment of a C# .net app with MongoDB. I tried to publish it but when I run, it goes not working. I know the error is that I need to manually run mongod.exe through C:/mongodb/bin/mongod. But how can I setup it without manually run the mongod.exe? Your help is highly appreciated. Thank you :)
You should understand that your .NET application and Mongo database are different parts of the system. They even can be placed on different machines. So, publish of your application shouldn't affect availability of database.
However you can combine these two actions in one simple batch file:
msbuild.exe [your app with necessary options]
C:/mongodb/bin/mongod.exe [options]
On how to build and deploy web-apps via msbuild you can see here:
How to Publish Web with msbuild?
Invoke a publish from msbuild for visual studio 2012
Invoke a publish from msbuild for visual studio 2012
You probably want to set up mongodb to run as a windows service, rather than manually starting the server on demand.
Instructions can be found here:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/

Publish a web service on Visual Studio 2010

I created a web service in C#, using Visual Studio 2010 ( Framework .NET 3.5). In debug mode it works great, but now I must publish it on the internet, so that I can consume it in remote (the app that will consume the web service is an android app).
So the question is: how do I publish my web service on Internet so that I can consume it in remote?
Thanks in advance; this is a work for taking my degree!
A simple way: you switch to release mode, update your web.config for production, right click on your service project and from the menu select publish. Then you publish it to the local folder. This way it copies only the files needed. Then you copy the contents of the folder to your remote site using ftp, for example, your hosting provider should have given you the credentials.
for some hosters it is also possible to publish directly but I don't use this.

How to deploy a C#, MVC4 application on Azure using Git

I am developing a C#, MVC4, EF5 Code First application on .NET in Visual Studio 2012 and have used the VS publish mechanism to deploy it to an Azure Website with an Azure SQL Database.
I now want to use Git and GitHub for version control and involve others in the project.
However, although I am familiar with using Git in a LAMP environment, I have no experience of using Git with Windows, Azure Websites and a compiled environment.
I would like to use the Azure Website as the production server, another Azure Website as a Staging server, developer Windows machines using Visual Studio for development and GitHub as the central repository.
There is a helpful article here: http://www.windowsazure.com/en-us/develop/net/common-tasks/publishing-with-git/ . I can get my head around what would be needed here for, say, a PHP application on Azure. But I am unsure of the best approach with a compiled application and what I can achieve using Azure Websites and Visual Studio.
A nudge or two in the right direction would be greatly appreciated!
don't publish from VS to azure, instead setup your azure website to pull from the github repo. the deployment process compiles your solution.
watch http://www.youtube.com/watch?v=5NGieL0tinw&feature=youtu.be&hd=1 or read http://vishaljoshi.blogspot.com/2012/09/continuous-deployment-from-github-to.html
Also SocttGu announced this on his blog # http://weblogs.asp.net/scottgu/archive/2012/09/17/announcing-great-improvements-to-windows-azure-web-sites.aspx he also talks about a cool feature of publishing branches, this will nail your requirement for a stage server and production server. Have a stage branch and a production branch and merge to them as desired. see the section "Support for multiple branches"
looks like they added support for private repos finally.
appharbor is a competitor to azure that does something similar.
You are basically introducing a new step with the requirement that the source code must be compiled before it can be deployed to the server. Where you implement this step is up to you. You could:
Ensure that your target server has the capabilities to compile the source code (some Continuous Integration tools could help with this, such as CruiseControl.NET). This has the caveat that the target server be able to compile source code (possibly even requiring Visual Studio to be installed), so that may not be an option.
Check the compiled binaries into source control. You could keep these compiled binaries separate from the main source branch, to keep things clean. Deploy the binaries to the target server.
Some hybrid of the previous two options is also possible; you could set up a Continuous Integration server with CruiseControl.NET, which can check out the current source, build it, and check the resulting binary back into a special branch, then deploy that branch to your target Server.

Categories

Resources