Web deploy with MSBuild deploys only BIN folder - asp.net

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:

Related

ASP.NET Web Forms Application Folder not deployed to AWS Elastic Beanstalk Application

The ASP.NET Web Forms Application that I've designed, contains a folder where the excel sheets that I require for the web reside. I've deployed the Web Application to AWS using the AWS Toolkit in the VS 2017, and could successfully get the application running over the Web. But, when I did something on the web (like Upload) which makes use of that folder, it resulted in exceptions and when I look at them through Log files later, I discovered that the Folders weren't even uploaded in the deploy process. Is there any way I could get the folder deployed as well?
Please ensure that the folder is included in your project before publishing. In Solution explorer, click on the Show All Files icon
And once the folder is displayed in the Solution Explorer, right click the folder and then Include in Project

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 an ASP.NET vNext application be hosted in IIS

I'm struggling to workout how to host a local ASP.NET vNext application in IIS. Is this possible currently or is just selfhosting or IISExpress available. Or am I missing the point?
You can use 'kpm pack' to create a package and then drop that in the wwwroot folder. Create an application in the IIS Manager. Refer to the 'using command line' section in the below link to create the packaged web project https://github.com/aspnet/Home/wiki/FTP-deploy-an-AspNet-vNext-application-to-Microsoft-Azure-websites
You can also right click a project in VS14 and click Publish, then choose Filesystem in the dialogue.
Yes, I deployed my app in my local IIS server.
As you can see publish vNext to local system generate two folders approot and wwwroot
You should copy these 2 folders on IIS and specify folder wwwroot as Site Folder

Deploying a asp.net website using team city

How to deploy a web site project, which does not have any project file.
we are trying to automate build and deployment using team city.
i am able to successfully build the project, but not able to deploy the web site.
MsDeploy supports deployment of WebSites via contentPath provider:
msdeploy -verb:sync -source:contentPath=WebSite\Deploy,computername=localhost -dest:auto...
Just change WebSite\Deploy to your actual path in your agent working directory, where is your builded website for deployment.

Where is web.config file when running Azure web role in Compute Emulator?

I created an empty Azure Cloud Service project, then added a web role there. The role project has a web.config file.
When I hit F5 the role is deployed in Compute emulator. I went into the folder where role binaries are deployed - there's no web.config file there.
What's happening? Is that because I didn't set "copy always" on web.config file? What web.config does my role use?
If your role is configured for Full IIS mode (for those unaware of the difference between Hosted Web Core and Full IIS, see this blog post), the compute emulator should deploy the web role to IIS where it can be viewed in IIS Manager. On my machine (I'm running Azure SDK 1.5), the deployed web role's physical path is my source code directory.
I think web.config is compiled into your assembly as content in your development environment, and is not directly accessible like in staging/prod. You don't need to use Copy Always, if its marked as Content its all you need. You can use Environment.CurrentDirectory to see your web root path.
Even though the preferred way of storing configuration in Windows Azure applications is in the ServiceConfiguration.cscfg file, there are still many cases when you may want to use a normal .NET config file - especially when configuring .NET system components or reusable frameworks. In particular whenever you use Windows Azure diagnostics you need to configure the DiagnosticMonitorTraceListener in a .NET config file.
When you create your web role project, Visual Studio creates a web.config file for your .NET configuration. While your web application can access this information, your RoleEntryPoint code cannot-because it's not running as a part of your web site. As mentioned earlier, it runs under a process called WaIISHost.exe, so it expects its configuration to be in a file called WaIISHost.exe.config. Therefore, if you create a file with this name in the your web project and set the "Copy to Output Directory" property to "Copy Always" you'll find that the RoleEntryPoint can read this happily. This is one of the only cases I can think of where you'll have two .NET configuration files in the same project!
All info is from Azure Team Blog and I have used this solution successfully- http://blogs.msdn.com/b/windowsazure/

Resources