MSBuild Community Tasks Documentation [closed]

给你一囗甜甜゛ 提交于 2019-12-03 09:30:55
Benjamin Baumann

The documentation is like you say really scarce. The best I found is to download the latest source code here : https://github.com/loresoft/msbuildtasks

The latest documentation can also be viewed via GitHub directly without downloading the source: https://github.com/loresoft/msbuildtasks/tree/master/Documentation

If installed using the MSI, you can also look at the XSD found in the installation folder (C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.xsd) to at least see which tasks are avaialable to you and the documentation connected with them.

The latest releases on Github do not include documentation (issue #24).

Older releases on Tigris do include documentation in the form of a CHM file: After installing MSBuild.Community.Tasks.msi from the project download page, the documentation is in the installation folder. The typical path is "C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.chm".

The documentation is sublime, but missing completely. However, the code is really easy to read - at least for finding out available tasks and their inputs/outputs.

The way I do it:

  1. Install a .NET decompiler like Jetbrains dotPeek (or some other .NET Reflector free clone).

  2. PM> Install-Package MSBuildTasks (from VS) OR
    > nuget install MSBuildTasks (from cmd line)

  3. Open slnDir\.build\MSBuild.Community.Tasks.dll in the above mentioned dotPeek, navigate to namespace MSBuild.Community.Tasks and double-click the task you're interested in.

  4. Profit!

Came across this as I was looking for the same info, so may as well add an example of a complete MSBuild target which creates an FTP folder and then copies the contents to the new location. NB the example uploads to a secure site, so you may need to change the port number to suit your situation.

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />

  <Target Name="MSBuildFTP">    

    <PropertyGroup>
        <ftpHost>Your Host</ftpHost>
        <ftpUser>Your username</ftpUser>
        <ftpPass>you guessed it.. your password</ftpPass>
    </PropertyGroup>

    <Message Text="Create the directory if it does not exist - FtpUploadDirectoryContent fails if the dir does not exist" /> 
    <FtpCreateRemoteDirectory 
        ServerHost="$(ftpHost)"
        Port="21"
        Username="$(ftpUser)"
        Password="$(ftpPass)"
        RemoteDirectory="SSL/secure/"
        />

    <Message Text="Copy the contents of our directory to the ftp location" /> 
    <FtpUploadDirectoryContent
        ServerHost="$(ftpHost)"
        Port="21"
        Username="$(ftpUser)"
        Password="$(ftpPass)"
        LocalDirectory="deployment"
        RemoteDirectory="SSL/secure"
        Recursive="false"
        />
  </Target>
</Project>

You can use the XSD to check available options as well.

Cheers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!