How do I configure "appOfflineTemplate" in a publish profile (.pubxml)? - msdeploy

WebDeploy 3.5 supports customizing App_Offline.html via an App Offline Template option to msdeploy. Example:
msdeploy.exe -verb:sync -source:iisApp=sourceApp -dest:iisApp=destApp,appOfflineTemplate="App_offline-template.htm" -enablerule:AppOffline
In a publish profile I can specify -enablerule:AppOffline via the option
<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
Can I do the same with appOfflineTemplate ?
Reference: https://blogs.iis.net/msdeploy/webdeploy-3-5-rtw

Currently not possible. Read more at: https://aspnet.uservoice.com/forums/41199-general-asp-net/suggestions/6619898-enablemsdeployappoffline-appofflinetemplate

Related

Jenkins - MSBuild for ASP.NET CI without local IIS

Background: I am doing a POC for CI using Jenkins and MSBuild. I have installed Jenkins, MSBuild plugin and other required components on my machine and configured as well. But I don't have IIS configured on my development machine.
I want build the ASP.NET website and output the published code in a folder "c:\precompiledweb" using MSBuild script. I have
Can someone help me with MSBUild Script.
Make sure you read the prerequisites for functionality.
https://msdn.microsoft.com/en-us/library/1y1404zt.aspx
Walkthrough: Deploying a Web Site Project by Using the Publish Web Site Tool
Prerequisites
In order to complete this walkthrough, you will need the following:
Visual Studio.
*This walkthrough assumes that you selected the Web Development collection of settings when you started Visual Studio the first time. For more information, see How to: Select Web Development Environment Settings.
Access to Microsoft Internet Information Services (IIS) so that you can test the result of publishing a Web site project. In this walkthrough, it is assumed that you have IIS running on your own computer. Alternatively, you can use any instance of IIS for which you have permission to create a virtual directory.*
You need access to some IIS server.
On the flip side....you need to keep this general rule in mind. Jenkins is simply a fancy wrapper for command line calls.
So test the below (article) on your machine without IIS. If you can get the command line to work (outside of jenkins), most likely you can get it working (inside jenkins)
http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/command-line-deployment
Configure Source Code Management section, i.e. for TFS:
Add build step "Execute Windows batch command"
Insert msbuild invocation to your solution, i.e.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
"%WORKSPACE%\{solution_name}.sln"
You can add some optional parameters.
After build you can add another script invocation (batch, powershell, whatever) for copy project output to specific folder, but I would prefer another way: publish to IIS and run application immediately.
in Visual Studio create publish profile with WebDeploy target (help)
enable Web Deploy in IIS on test machine (help - when componentes are already installed go to "USING THE IIS MANAGER TO CONFIGURE WEB DEPLOY FOR A NON-ADMINISTRATOR" section)
add publish parameters to jenkins job from step 2, i.e.:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe
"%WORKSPACE%\ {solution_name}.sln"
/P:DeployOnBuild=true
/p:PublishProfile="{publish_profile_filename}.pubxml"
/p:Configuration=Release
/p:Platform="Any CPU"
/p:Password={Password_for_publish_profile_same_as_used_in_VS}
And now you have jenkins click-once job for build and publish solution to test server. Add Source Code change trigger and you have basic CI.

Can we retrieve asp.net project from azure?

I am working on a asp.net test project. I were deploy the project to windows azure. After that I add some code and the project stop working, but the project on azure is still working. Is there any way that can make me retrieve the project from azure ?
In visual studio, I can connect to windows azure and displaying the projects that I deployed to it. I can see some of the files but not all. The important files for me which is the controller files doesn't appear.
Azure isn't source control. What you would have published to azure (I'm hoping) will not be the whole code but a 'published' version of it.
Short answer would be no
When you publish a Web dev project to Azure Visual Studio compiles all the source code (.net) you have. Then the compilation results are binary files (.dll) and some other website assets like css,js and html files.
So there are no .Net source files from your project published into the website, because of that you can't get your source files again.
I strongly recommend you to check these links
Continuous deployment using GIT in Azure App Service
Using Git
in Visual Studio
spanish demo - Repositorios Git privados y
gratuitos
Besides of that you can try to use any source code repository or ALM suite, As you're using azure you can also use Visual Studio Online to host your projects for free and also be able to publish directly to azure repositories.
more info Visual Studio Online
You can not get code from this method. use FTp tool, like Core FTP, FileZilla for that.
These are steps get ftp of your web application.
Go to azure (https://portal.azure.com).
Select web app from browser all option.
Select you app from list an then click on settings option.
Then click on properties, then enable you ftp and create password for that.
FTP/Deployment User , FTP HOST Name , Password
Note: You will not get your code fils( .cs).

Web deploy with MSBuild deploys only BIN folder

I have a website project (not a web application) and I want to set up deployment after builds with TFS. I have set this up and got it to work. I set up the build agent machine and the server and also created a publish settings file for the website project.
I know that the publishing agent is communicating with the IIS management service and that all permissions are set correctly, since after a build MSBuild does deploy the bin folder to the target. What I don't understand is why the rest of the website is not copied as well.
I run MSBuild with the following arguments:
/p:DeployOnBuild=True /p:AllowUntrustedCertificate=True /p:PublishProfile=QA /p:VisualStudioVersion=12.0 /p:UserName=[my AD user name] /p:Password=[my AD password]
I know these settings are correct, since the bin folder does get published, but how do I get the rest of the website project to publish as well?
What do you mean with the "rest of the website". Typically all your website assets are compiled into binaries and deployed like that.
If you wish to deploy additional files you can do this in the publish settings in your project properties:

How to publish Asp.net Web Application from a Web Service or Windows Form App(Not from Vs editor)

I am working on a project and we need to deploy our web projects to server but these web projects are creating dynamically by end users. so we gather all files of web project in a file. finally we need to push these files to server with publish. but how can i do without VS editor's manual publish option. do u have any website or any source that example to my aim, or if you know sth about it can you help me?
You can use Visual Studio in command line mode to do the same but assuming that you probably do not have access to VS on, your next bet would be MSBuild.
See these links that tells how to use MSBuild to publish a web project:
http://blog.m.jedynak.pl/2008/03/publishing-web-application-with-msbuild.html
How do I publish a Asp.NET web application using MSBuild?

ASP.NET Website installs/updates

I am looking for some ideas on how to offer a installation package for my ASP.NET website. Some things I need to be able to do is read/write Registry keys, get the database(s) information and test the connection and I must be able to overwrite the existing website without an uninstall and update the web config on new versions. I do not wish to uninstall the website and re-install it. I would like minimum downtime on upgrades. I think I am going to have to implement a custom solution and if this is true how can i include all the output of my web application into my custom solution?
EDIT: I am not installing this on my own system(s). This is for distribution to other clients who will be installing/upgrading the website. It is important that I be able to upgrade to the latest asp.net website without uninstalling. Ideally it would be overwriting the existing site and updating the web.config file.
Option 1. Create web application installation package
Use Web Setup Project for creating a web application installation package (.msi)
Creating or Adding a Setup Project at MSDN
You can create your installation the way it will offer user an Upgrate option of your application if it's already installed on his or her machine. That's not a problem.
Alternatives to Web Setup Project (all of them can handle upgrade scenarios):
Wise Installation Studio
InstallShield
Nullsoft Scriptable Install System - this one is free and open source
Optoin 2. Deploy web application on the server
You can use NAnt or MSBuild or IIS Web Deployment Tool for these tasks automation.
For example with NAnt of MSBuild you could specify tasks like these:
get project files from source repository
update .config file and maybe some other files if needed
compile you web application
update registry settings on the server
update database schema on the server
synchronize files (x-copy) between you build folder to IIS web folder
Web Deployment Blog
Option 3. Distribute your web applications via Web Plafrom Installer.
http://www.microsoft.com/web/
Have you looked into Web Deployment Projects or the IIS Web Deployment Tool?
I think you can build asp.net application into .msi package and install it. Is that what you are looking for? And then you can build all of your customization into pre-deployment and post-deployment scripts.
I use NAnt and NSIS with some small console apps where they can't easily do some manipulations I require.
Do you tried the new Microsoft Web Platform Installer (new! 2.0 beta)?

Resources