I'm trying to deploy a web application using MSDeploy, on Team Build in TFS. There are several questions that address the properties that have to be passed in MSBuild in order to call MSDeploy, but I haven't found sufficient documentation for what properties are available. Does someone have a list of available properties?
Here are some questions that I've found, but I haven't been able to find a definitive list of the properties:
Breaking MsBuild package & deploy into separate MsBuild and MsDeploy commands
How can I get TFS2010 to run MSDEPLOY for me through MSBUILD?
Here's a list I've compiled for my own reference, along with some of the legal values that can be used. Note that these are passed into MSBuild using the /p:<PropertyName>=<Value> syntax.
DeployOnBuild
True
False
DeployTarget
MsDeployPublish
Package
Configuration
Name of a valid solution configuration
CreatePackageOnPublish
True
False
DeployIisAppPath
<Web Site Name>/<Folder>
MsDeployServiceUrl
Location of MSDeploy installation you want to use
MsDeployPublishMethod
WMSVC (Web Management Service)
RemoteAgent
AllowUntrustedCertificate (used with self-signed SSL certificates)
True
False
UserName
Password
SkipExtraFilesOnServer (leave existing non-conflicting files alone)
True
False
Unfortunately documentation for this is almost non-existent at this point. If the various blog posts and forum posts aren't comprehensive enough, you can always look at the .target file that MSDeploy uses which shows how the various properties are used if you are willing to spend the time to wade through copious amounts of XML.
On my machine it's located here:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets
I don't know if this is what you are looking for but you can invoke msdeploy with the /? argument and it will display a list of valid arguments
How about this one /p:IncrementalBuild=True
Some more here https://msdn.microsoft.com/en-us/ff622991.aspx (for sharepoint)
To create a package in build:
/p:IsPackaging=true
To set the publish directory in the same drop output location:
/p:PublishDir=
When your solution contains multiple app projects, set the following parameter to produce app specific publish directories.
/p:AppSpecificPublishOutputs=true
WebDeploy configuration of a SelfContained .NET Core2 application.
Note 2 mandatory properties:
Missing RuntimeIdentifier throws:
error NETSDK1031: It is not supported to build or publish a
self-contained application without specifying a RuntimeIdentifier.
Please either specify a RuntimeIdentifier or set SelfContained to
false.
Missing DeployIisAppPath can throw:
error : Property 'DeployIisAppPath' must be non-empty.
In case you are passing the parameters to dotnet publish, avoid circular dependency with /p:DeployOnBuild=false
error MSB4006: There is a circular dependency in the target dependency
graph involving target "Publish".
Complete WebDeploy configuration for command line:
/P:WebPublishMethod=MSDeploy
/P:DeployOnBuild=True
/P:DeployTarget=MsDeployPublish
/P:TargetFramework=netcoreapp2.0
/P:SelfContained=true
/P:MsDeployServiceUrl=https://my_subdomain.jobit.io:8172/MsDeploy.axd?site=subdomain_path
/P:AllowUntrustedCertificate=True
/P:MSDeployPublishMethod=WMSvc
/P:CreatePackageOnPublish=True
/P:UserName=OTB
/P:Password=Expert
/P:RuntimeIdentifier=win-x86
/P:DeployIisAppPath=subdomain_path
Related
I tried to push the test result (*.trx) to MTM by command line. I used msttest /publish or tcm run /publish. With both I can't get the correct project path, anyone know how to find the path?
Attempted:
/collection:"mtms://companyName.visualstudio.com:443"
/teamproject:"MyProject/Testing/testplan"
Error: TF249051: No URL can be found that corresponds to the following
server name:
Tried to remove mtms:// and just used https://companyName.visualstatudio.com:
The following team project cannot be found:
How do I find out what is the correct project path?
The /publish command is used to associate test runs/results with builds. MTM is displaying test results that are associated with test plans/suites which are somewhat independent of builds.
/publish: [ server name]
Use the /publish option to publish test data to the database for the
team project collection associated with the project's Team Foundation
Server. When you use the /publish option, you must correctly specify
the name of the Team Foundation Server. The correct format depends on
whether the Team Foundation Server has been registered on the client
computer, as described here: Command-Line options for publishing test
results
Using this command the results will successfully published to build.The published result is viewed in your build summary, but they don't appear in MTM. There is no way to view the result in MTM. Please refer this similar question.
TCM is a command line interface to running tests, similar to mstest, but it runs the tests through the infrastructure you set up in MTM. To publish .trx files to MTM/TFS, you're going to have to use tcm.exe not mstest.exe to get what you're after. Sample command as below:
tcm run /publish /suiteid:XXXX /configid:X /resultowner:"ABC XYZ" /resultsfile:C:\TempResult.trx /collection:http://<<TFS URL>> /teamproject:"My Project" /runowner:"ABC XYZ" /build:<<Build Number>> /builddefinition:<<Build Definition Name>>
Note: please double check your server url is suitable.
I installed the TSLint plugin for sonarqube in my Jenkins server https://github.com/Pablissimo/SonarTsPlugin. But its not described the git page as to how to set the configuration properties and values. How to specify the source directory, how to ignore test directory are two main concerns. Can some one provide an example configuration property set with basic configurations that I can use in my Jenkins?
You can use a sonar-project.properties file for configuration. There are some example projects provided by SonarSource that might be helpful.
Here's a quick example of how you could set the source directory, test directory, and files to ignore:
sonar.sources=client-app/src
sonar.tests=client-app/test
sonar.exclusions=client-app/node_modules, client-app/lib
UPDATE:
The sample projects have moved here. There isn't a JavaScript example anymore, but the syntax would be the same for any language.
The documentation for parameters that can be set is currently located here:
https://docs.sonarqube.org/display/SONAR/Analysis+Parameters
I have an MVC site that I am publishing through the command line using the arguments
msbuild.exe /p:DeployOnBuild=true /p:PublishProfile=Test MyProject.csproj
The MyProjectproject has a reference to another web application project MyReferencedProject. This is used to store shared Razor views and other shared code with another web site. (Making the project type as a Web Application was recommended by RazorGenerator so that I get intellisense when working with Razor views) This project functions like a class library, and should never be published.
The issue is that when I run the command above, I get the error that it can't find the Test.pubxml for MyReferencedProject:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4352,5): error : The value for PublishProfile is set to 'Test', expected to find the file at 'C:\Projects\MyReferencedProject\Properties\PublishProfiles\Test.pubxml' but it could not be found.
How can I run msbuild to publish MyProject without it also trying to publish MyReferencedProject?
I found I can work around the issue by adding a Test publish profile for this project, but that means I have to set up some place to put the code when it's published, which really shouldn't be generated at all.
Try changing your command line to:
msbuild.exe /p:DeployMyProject=true /p:PublishProfile=Test MyProject.csproj
Then add the following property group to MyProject.csproj before any Import statements:
<PropertyGroup>
<DeployOnBuild Condition="'$(DeployMyProject)'!=''">$(DeployMyProject)</DeployOnBuild>
</PropertyGroup>
This solution is based on: How to publish one web project from a solution.
My team is starting to take on the challenge of automating our Build-Deploy-Test process, beginning with the build.
Right now we have Build Definitions configured in TFS that will publish our site to our servers using Web Deploy, and this is working; however, we aren't able to keep an archive of the packages that would be created with each build because when we turn on package creation with the MSBuild parameter /p:CreatePackageOnPublish=true, the build fails on silly NTFS file length constraints.
Exception Message: TF400889: The following path contains more than the allowed 259 characters: \\builds.tfs.company.com\builds\Project.Dev.Nightly\Project.Dev.Nightly_20130630.6\Debug\_PublishedWebsites\Project.Middleware.Service_Package\Archive\Content\C_C\Builds\1005\Project\Project.Dev.Nightly\Sources\Source\Multi\Middleware\Project.Middleware.Service.
Is there a way that we can break the Archive folder out somewhere else?
You can edit the path by using the _PackageTempDir argument for MSBuild.
Just add _PackageTempDir=D:\{desired dir structure} when you're passing in MSBuild arguments.
More full explanation of this property can be found here -
VS2010 Web Deploy: how to remove absolute paths and automate setAcl?
I need to setup a scheduled task in Windows Task Scheduler (v2.0 on Windows Server 2008 R2) right after my web site deploys.
I am using TFS 2010 to build my application, and apparently my MSBuild Arguments contain arguments /P:DeployOnBuild=True /P:DeployTarget=MSDeployPublish /P:CreatePackageOnPublish=true /P:MSDeployPublishMethod=WMSvc.
I know that I can use Schtasks.exe to setup a scheduled task via command line, I also know there is a runCommand provider for MsDeploy. So I thought I could use runCommand to run Schtasks.exe with required parameters.
My question is how I do it in TFS and MsBuild. I assumed I could pass some parameters to MsBuild, and they would be transferred "as is" to MsDeploy, but I could not find how I do it.
If it must be after the build, you'll need to use the postSync msdeploy argument to execute a runCommand. Since postSync is not available from Visual Studio's MSBuild tasks, you'll need to generate a package and then run the generated cmd file with the postSync argument tacked onto the end.
Package.cmd -postSync:runCommand="c:\windows\system32\schtasks.exe arguments"
If it should be after the build, you can include an additional provide by adding the following to your publish profile (pubxml), .wpp.targets file or your project file:
<ItemGroup>
<MsDeploySourceManifest Include="runCommand">
<Path>"c:\Windows\system32\schtasks.exe" "Arguments here"</Path>
</MsDeploySourceManifest>
</ItemGroup>
It's not officially guarantees that providers run in order, but in practise they do. You might need to hook a target into the right event, though, so you can register your runCommand after the other providers.