TFS2012 - Troubleshooting MSBuild arguments to set up automated deployment - msbuild

We are trying to set up automated deploys through TFS 2012 via MSBuild and MSDeploy but we are recieving a timeout when our production server attempts to deploy to the development server. All relevant ports have been opened, the deployment tools and services have been installed and started, the only evidence of an error we have to go on is a log file which came from the development server's IIS web management log folder, it is displaying a 404 when a deploy is attempted.
MSBuild arguments:
/p:DeployOnBuild=True
/p:UserName=*****
/p:Password=*****
/p:AllowUntrustedCertificate=True
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MSDeployPublishMethod=WMSVC
/p:MSDeployServiceUrl=http://*******:8172/msdeploy.axd
/p:DeployIISAppPath="DeployTest"
Visual Studio build error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets (4377): Web deployment task failed. (Could not complete the request to remote agent URL 'http://****:8172/msdeploy.axd?site=Default Web Site'.)
Could not complete the request to remote agent URL 'http://****:8172/msdeploy.axd?site=Default Web Site'.
The operation has timed out

Related

How to create an IIS Web Deploy Package from dotnet cli running in Linux

I have an ASP.NET Core app which currently runs under IIS in a Windows Server machine. To deploy that app there's a release pipeline that takes a Web Deployment Package (zip) as input.
I'm trying to create that Web Deployment Package from a Linux VM with a command similar to this:
dotnet build /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="/temp/WebApp.zip" /p:DeployIisAppPath="Default Web Site" /p:VirtualDirectory="" /p:Configuration=Release /p:Platform="Any CPU"
This is causing this error:
usr/share/dotnet/sdk/5.0.400/Sdks/Microsoft.NET.Sdk.Publish/targets/PublishTargets/Microsoft.NET.Sdk.Publish.MSDeployPackage.targets(183,5): error MSB4181: The "CreateManifestFile" task returned false but did not log an error. [/app/WebApp.csproj]
Anyone knows how to fix this problem? I googled and search other SO answers but couldn't find anybody trying to build a Web Deployment Package from a Linux OS.
I can successfully build that same project from a Windows VM that has Visual Studio installed but can't do it from Linux. I understand some features are tightly related to Visual Studio but I'm surprised there's no work around or any documentation at all on how to get this done.

Error when running IIS Express from command line with ASP.NET Core app (VS2017)

I'm trying to run IISExpress manually, in order to add OpenCover coverage later.
This is with an .NET Core 2.2 app.
I am able to launch the app from within Visual Studio and everything is running fine.
Now i want to start it manually on command line.
I use the applicationhost.config generated by VS.
I followed what was said in the answer to OpenCover for ASP.Net Core application running on IIS Express,
namely, adapted to my environment:
I'm doing this from a (non-admin) command prompt in
C:\Program Files\IIS Express>
set LAUNCHER_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\VSIISExeLauncher.exe
set LAUNCHER_ARGS=-p "C:\Program Files\dotnet\dotnet.exe" -a "exec ""C:\Workspace\wk1\nSKEP\Dev\WebAccess\Dscp.Api\bin\Debug\netcoreapp2.2\Dscp.Api.dll"""
iisexpress.exe /config:"C:\Workspace\wk1\nSKEP\Dev\WebAccess\.vs\config\applicationhost.config" /site:Dscp.Api
IISExpress launches and runs.
But when i try to connect to my site, i get the following response:
HTTP Error 500.0 - ANCM In-Process Handler Load Failure
Common causes of this issue:
* The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
* The in process request handler, Microsoft.AspNetCore.Server.IIS, was not referenced in the application.
* ANCM could not find dotnet.
Troubleshooting steps: Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028526
I have visited the linked site and googled but didn't find any help.
In Win10 System Event viewer, i get the following error for "IIS Express AspNetCore Module V2":
Application 'C:\Workspace\wk1\nSKEP\Dev\WebAccess\Dscp.Api\' wasn't able to start. Application .dll was not found at C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\VSIISExeLauncher.dll
What is obviously intriguing is that it talks about VSIISExeLauncher.dll while i have specified VSIISExeLauncher.exe in the path.
What is wrong?

Deploying a .Net application built in VSTS to a remote agent machine

I have been trying to figure this out for a few days to no avail.
I have an MVC .Net Application that is stored in a GIT repo in VSTS. When I check in code it is being built and unit testa are being run in the cloud.
Now If these unit tests succeed I would like the project to be deployed to a remote machine that has the VSTS agent installed. I can see the agent in the VSTS web interface but I don't know how I get the automatic build to send the completed build to d:/mydeploypath on the remote agent machine.
Is this possible?
Absolutely possible!
There are build steps available to copy files to a remote machine such as Copy Files over SSH and Windows Machine File Copy. But if you are trying to deploy the code to the machine you are building on, you can use the Copy Files step since it won't require credentials. Since it is a web application, there are a few steps like IIS Utilities to stop\start the application pool so the files won't be locked for the deployment.
So using the Copy Files build step, you could use $(Agent.BuildDirectory) as the source directory (or wherever you have your build output going) and set the target folder to your desired destination on the machine.
The build/release variables helped me out a lot during the development of our release process:
https://learn.microsoft.com/en-us/vsts/pipelines/build/variables?view=vsts
The easy way is using WinRM-IIS Web App Deployment task.
To generate the web deployment package, you can specify these arguments in MSBuild Arguments box of Visual Studio Build task:
/p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageLocation="$(build.artifactstagingdirectory)" /P:PackageTempRootDir=""

VSTS - publish a web application and copy files over SSH

I have a build process on VSTS which builds the web solution .sln file and publishes the artifact. All seems to be working fine.
Now I wish to use the artifact in a release to 'Publish' the web application and copy the published files over to a windows VM via SSH.
How can I get VSTS to 'publish' the application like it publishes in Visual Studio, or can I use the build Visual studio to publish.
.Net Framework Application.
Image - Build process in VSTS
If you must use SSH you can in your Release pipeline you can use the "Copy Files Over SSH" Task:
If you do not have to use SSH you can use the "Windows Machine File Copy" task:
These tasks will copy the build artifact to your windows VM.

How can I enable checkbox 'deploy' in my solution configuration

I am using Visual Studio 2013. My solution contains multiple projects. there is one MVC4-project. When I build my solution via MSBuild on Jenkins I want to deploy the MVC4-project:
The chekbox is disabled. How can I enable this checkbox?
Basing on answer to the same question https://social.msdn.microsoft.com/Forums/vstudio/en-US/6bd461d5-79ce-4cd1-b4f4-1cc55e2abc5b/what-we-need-to-have-the-deploy-checkbox-in-configuration-manager-enable-?forum=visualstudiogeneral - it seems that Deploy have nothing to do with publishing, but is about some projects, which Visual Studion treats as deployable.
To deploy you project via Jenkins, you can pass following parameters to build:
/p:MsDeployServiceUrl=computername or path to msdeploy handler on remote computer (https://some_site:8172/msdepoy.axd
/p:UserName=username for deployment (either administrator or must be allowed at IIS level for site)
/p:Password=password for user above
/p:AuthType=Basic
/p:AllowUntrustedCertificate=True (if you are using self-signed certificate for msdeploy)
/p:DeployIisAppPath=iis site name
/p:DeployOnBuild=True
/p:DeployTarget=MsDeployPublish