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.
Related
I have a solution that has a Web Site (not a Web Application) and I'm having trouble setting up my Visual Studio Build task.
Usually I setup my MSBuild Arguments like so
/p:DeployOnBuild=true
Then in my Copy Publish Artifact, I e
$(build.sourcesDirectory)/AppSolution/Website/obj/$(BuildConfiguration)/Package/PackageTmp
What MSBuild Arguments do I need to set so that I can make the above work?
The files do not get copied over to the obj/$BuildConfiguration)/Package/PackageTmp folder. So when I go look at the output folder, it just looks like the code files. Not the binaries
Use the MSBuild argument /p:PackageLocation=$(Build.ArtifactStagingDirectory), then publish $(Build.ArtifactStagingDirectory) as an artifact.
I have a software that up to now was run with UI or command scripts. My job was removing all UI and make it run automatically using tfs builds.
Using TFS 2012 VS 2012
My questions:
1. How to run software that it is being build. I tried with MSBuild Arguments using
/p:DeployOnBuild=True /p:DeployTarget=Package /p:CreatePackageOnPublish=True
/p:OutputPath=bin /p:VisualStudioVersion=11.0 /p:MSDeployPublishMethod=InProc
/p:MsDeployServiceUrl=localhost
/p:DeployIisAppPath=#"\\filer01\FDrive\public\documents\new\\"
No errors, but my testing solution doesn't produce anything. For testing it should create a file. Same code works fine from within custom code activity so it means the software doesn't run. I want to run software from source control.
Question 2. What is the best way to pass arguments from TFS Build Definition to software I am Building and Running? Can I call them from withing software?
Edit:
Solution:
custom activity:
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = String.Format("{0}\\TestingForm.exe", binaries)
}
};
process.Start();
process.WaitForExit();
I've never tried the DeployIisAppPath argument but we routinely used TFS build definitions in the past to deploy our code to a remote IIS server. Works great. Maybe you can try dropping the DeployIisAppPath and deploying to local IIS instead?
The MSBuild arguments can be accessed during the build step. You can instruct MSBuild in your wpp.targets file to take those values and use them to alter the application files but it all depends how you want to use them.
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
Is there any tutorial to show how can I use MSBuild tasks like FtpUploadDirectoryContent to copy file/directory to a remote host using FTP in Team Build 2010? I never used a MSBuild task in TFS 2010.
Just put it in the AfterBuild target of one of your projects - probably best to put it in the project that's at the top of your dependency graph. You can add a condition if you don't want it to run in Visual Studio, or if you only want to do the FTP transfer for a particular build configuration. For example:
<Project>
...
<Target Name="AfterBuild" Condition="'$(BuildingInsideVisualStudio)'!='true'" >
<!-- Insert your FTP task here -->
</Target>
</Project>
See How to: Extend the Visual Studio Build Process
You might consider modifying your build process template (WF) and using the InvokeProcess activity call out to FTP.exe.
There are also a handful of FTP activities and command line utilties if the built in Windows FTP command line client doesn't work for you.
Wanting to build and test a bunch of Borland Delphi 6 projects that are integrated with ASP.NET services. Had been using WANT and CruiseControl for building Delphi. With TFS Build agent we can tie all together and do some testing. I am looking for guidance and direction.
One issue I see is that there is no "solution" in a Delphi project to be given to MSBuild as a '<'SolutionToBuild'>'.
<SolutionToBuild Include="There is no such thing as a Delphi.sln">
<Targets></Targets>
<Properties></Properties>
</SolutionToBuild>
Also, I have references to <UsingTask> but am a little unsure how to use them. The <UsingTask> allows run custom task for Delphi command-line compile.
Your guidance would be appreciated.
Can you upgrade? Delphi 2006+ uses MSBuild by default. There is nothing to configure.
You can use MSBuild to run the Delphi command line compiler. It's been a while, but I'm pretty sure either the IDE supports command line compilation or there is a stand-alone compiler that can be run from the command line. In either case, you would need to create an <Exec> task that runs the appropriate command line build tool with the required parameters.
When you say you have "references to <UsingTask>" do you mean that you are importing an external MSBuild task? The <UsingTask> element is used to pull in a custom MSBuild task that resides in an external assembly (DLL). Once the task is imported, you use it just like you would any other built-in task.