Visual Studio TFS doesn't deploy web project - iis

I am using Visual Studio team services (visual studio online). I have a visual studio solution with 12 projects including a Web project (front end), which I set up. I had setup a build and deploy pipeline and successfully deployed the project to IIS but on checking the deployed files I found that the Web project wasn't deployed, just the class libraries. Navigating to the website url gives and "unauthorised response".

Refer to these steps to deploy web app:
NuGet Restore task to restore packages
Visual Studio Build task (Solution: ***.sln; MSBuild Arguments: /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageLocation="$(build.artifactstagingdirectory)\"); Platform:xxx(e.g. $Buildplatform); Configuration: XXX(e.g. $(BuildConfiguration))
WinRM-IIS Web App Deployment task: (Machines:XXX; Admin Login: XXX; Password: XXX; Web Deploy Package: $(build.artifactstagingdirectory)\XXX.zip; Website Name: XXX

Works now, I just changed the Visual Stuio Version (in the build definition) to Visual Studio 2015, because that is where the app was written

Related

Azure Builds is adding an extra folder (win-x64) causing build to break

Given:
Visual Studio 2019 Web API .Net Core 3.1
Wix Toolset 3.1.1 (latest)
Wix Toolset Extension for Visual Studio 2019
Windows 2016 Azure DevOps 2019
All I'm trying to do is use Wix Toolset to create an .msi file for a very simple WebAPI project.
The build works perfectly locally of course, but when it runs in Azure Builds I get following error because an extra folder is getting added (win-x64)
Here's a snippet of build script in Azure Pipelines:
- task: VSBuild#1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:PublishProfile=FolderProfile'
configuration: '$(buildConfiguration)'
ication1\bin\Release\netcoreapp3.1\win-x64\publish\WebApplication1.exe'
Link:
C:\Program Files (x86)\WiX Toolset v3.11\bin\Light.exe -out C:\agent2\_work\4\s\SetupProject1\bin\Release\SetupProject1.msi -pdbout C:\agent2\_work\4\s\SetupProject1\bin\Release\SetupProject1.wixpdb -cultures:null -contentsfile obj\Release\SetupProject1.wixproj.BindContentsFileListnull.txt -outputsfile obj\Release\SetupProject1.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj\Release\SetupProject1.wixproj.BindBuiltOutputsFileListnull.txt -wixprojectfile C:\agent2\_work\4\s\SetupProject1\SetupProject1.wixproj obj\Release\Product.wixobj
Windows Installer XML Toolset Linker version 3.11.2.4516
Copyright (c) .NET Foundation and contributors. All rights reserved.
C:\agent2\_work\4\s\SetupProject1\Product.wxs(28): error LGHT0103: The system cannot find the file 'C:\agent2\_work\4\s\WebApplication1\bin\Release\netcoreapp3.1\win-x64\publish\WebApplication1.exe'. [C:\agent2\_work\4\s\SetupProject1\SetupProject1.wixproj]
##[error]SetupProject1\Product.wxs(28,0): Error LGHT0103: The system cannot find the file 'C:\agent2\_work\4\s\WebApplication1\bin\Release\netcoreapp3.1\win-x64\publish\WebApplication1.exe'.
C:\agent2\_work\4\s\SetupProject1\Product.wxs(31): error LGHT0103: The system cannot find the file 'C:\agent2\_work\4\s\WebApplication1\bin\Release\netcoreapp3.1\win-x64\publish\appsettings.json'. [C:\agent2\_work\4\s\SetupProject1\SetupProject1.wixproj]
##[error]SetupProject1\Product.wxs(31,0): Error LGHT0103: The system cannot find the file 'C:\agent2\_work\4\s\WebApplication1\bin\Release\netcoreapp3.1\win-x64\publish\appsettings.json'.
Done Building Project "C:\agent2\_work\4\s\SetupProject1\SetupProject1.wixproj" (default targets) -- FAILED.
Done Building Project "C:\agent2\_work\4\s\Solution1.sln" (default targets) -- FAILED.
Build FAILED.

Is there some way to add the Node JS Tools for Visual Studio (NTVS) test adapter to a VSTS hosted agent?

Is there some way to add the Node JS Tools for Visual Studio (NTVS) test adapter to a VSTS hosted agent?
The Visual Studio docs on hosted agent mention "Node.js Tools 1.0 for Visual Studio 2015" in the list for the "Hosted" agent, but the "Hosted VS2017" has no mention of any Node.js Tools
So how can you use the test adapter?
refer to these steps to run test on Hosted VS 2017 agent.
Modify project file (njsproj)
:
<!--<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>-->
<VSToolsPath>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\VisualStudio\v15.0</VSToolsPath>
Copy NodeJsTools folder in C:\Program Files (x86)\Microsoft Visual Studio\2017\[Community, professional or enterprise]\Common7\IDE\Extensions\Microsoft to your ntvs folder
Add these files to source control and check in changes
Queue build with Hosted VS 2017 agent.
Build definition steps:
NPM install (Working folder: $(Build.SourcesDirectory)\NodejsConsoleApp1)
Visual Studio Test task (Test assemblies: NodejsConsoleApp1\NodejsConsoleApp1.njsproj; Search folder: $(System.DefaultWorkingDirectory); Test platform version: Visual Studio 2017; Path to Custom test adapters: NodejsConsoleApp1\ntvs

Publish from VS works, xcopy of dotnet publish does not

We have a dotnet core app, full framework referencing a ef6 lib. Running publish to IIS from VS2017 works fine.
When running the following from TFS2017 it does not work (ef6 strange errors)
nuget restore ***.sln
dotnet restore src/CoolApp/CoolApp.csproj
dotnet publish src/CoolApp/CoolApp.csproj --configuration release --output $(drop)
(when releasing) Copy everything from $(drop) to IIS website
Comparing content the exe is of course different, and exe.config also.
Any ideas what we've missed?
Are you using TFS 2017 Update1. If you are using TFS 2017 Update1, please don't use the .netCore(preview) step first. Try to use the tasks in this document about build your ASP.NET Core app to see if it works. Steps are:
Command Line(Dotnet restore).
Visual Studio Build. Cause your project is created in VS2017, select VS 2017 in this step to build.
Command Line(Dot restore). publish --configuration release --output $(drop)
Publish build artifacts.
When in release, copy the artifacts from $(drop).

IIS 10.0.10586.0 on Windows 10: Missing Deploy option

I have installed IIS from control panel on Windows 10. Also Web Deploy 3.6 is already installed, maybe because I have installed visual studio 2013 ultimate and Visual Studio 2015.
Now I am trying to deploying a Web application on IIS. I have deployed it using "Web deploy package" publish method from Visual Studio. So from IIS, I am trying to import this package but Deploy option is missing under Default Web Site when I do right-click on it and hence that I cannot import application...
What's the problem?
Solution:
Using Web Platform Installer, uninstall web deploy 3.6 and install web deploy 3.5. After that an iisreset can be done.

How to determine if MSBUILD Arguments were executed for TFS Build Definition

I am using Team Foundation Service 2012, with a build controller hosted internally so I can deploy apps to our web servers. I setup the Build Definition, and am using the my Debug configuration, and have supplied the following MSBUILD arguments.
/p:DeployOnBuild=true /p:DeployTarget=MSDeployPublish /p:MSDeployPublishMethod=WMSVC /p:MSDeployServiceUrl=https://myserversname:8172/msdeploy.axd /p:AllowUntrustedCertificate=true /p:DeployIisAppPath="somesite.ourdomain.com" /p:Username=na\svc-users /p:Password=PASS /p:VisualStudioVersion=11.0
The solution builds just fine, I get no warnings, or errors. When I go my deployment server, the application is empty. I have setup the permissions to the web application folder, and inetsrv folder. I also installed/configured web deploy. If I am not getting any errors returned how can I tell what is going wrong with my Deployment? I have already checked the Event Logs on both the Build server, and the Deployment server, and neither have any errors or warnings. I can also do a publish from my dev machine and it works perfectly with the exact same parameters.
Copy these two folders, and their content, from your development environment to the build server:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications
These folders are a dependency which is caused by publishing through Visual Studio 2012. This dependency is referenced in the .sln file.
Unfortunately this means web deploy is failing silently.
Alternatively you could install Visual Studio on the build server but that would be a waste of a license.

Resources