Skip to content

Instantly share code, notes, and snippets.

@ctaggart
Last active January 4, 2016 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctaggart/8682871 to your computer and use it in GitHub Desktop.
Save ctaggart/8682871 to your computer and use it in GitHub Desktop.
SourceLink CodePlex TFS/SVN Demo using SLNTools
#r "packages/FAKE/tools/FakeLib.dll"
#load "packages/SourceLink.Fake/tools/Fake.fsx"
open System
open System.IO
open Fake
open Fake.AssemblyInfoFile
open SourceLink
let revision = "72529"
let versionAssembly = "1.1.2.0"
let versionFile = "1.1.2.1"
Target "Clean" (fun _ -> !! "**/bin/" ++ "**/obj/" |> CleanDirs)
Target "AssemblyInfo" (fun _ ->
CreateCSharpAssemblyInfo "AssemblyInfoCommon.cs"
[ Attribute.Version versionAssembly
Attribute.FileVersion versionFile ]
)
Target "Build" (fun _ ->
!! "CWDev.SLNTools.Core.dll/CWDev.SLNTools.Core.dll.csproj"
|> MSBuildRelease "" "Rebuild" |> ignore
)
Target "SourceLink" (fun _ ->
use repo = new GitRepo(__SOURCE_DIRECTORY__)
!! "CWDev.SLNTools.Core.dll/CWDev.SLNTools.Core.dll.csproj"
|> Seq.iter (fun f ->
let proj = VsProj.LoadRelease f
logfn "source linking %s" proj.OutputFilePdb
let files = proj.Compiles -- "../AssemblyInfoCommon.cs"
repo.VerifyChecksums files
proj.VerifyPdbChecksums files
proj.CreateSrcSrv "https://slntools.svn.codeplex.com/svn/!svn/bc/{0}/Main/%var2%" revision (repo.Paths files)
Pdbstr.exec proj.OutputFilePdb proj.OutputFilePdbSrcSrv
)
)
Target "NuGet" (fun _ ->
let bin = if isTfsBuild then "../bin" else "bin"
Directory.CreateDirectory bin |> ignore
NuGet (fun p ->
{ p with
Version = versionFile
WorkingDir = "CWDev.SLNTools.Core.dll/bin/Release"
OutputPath = bin
}) "CWDev.SLNTools.Core.dll/CWDev.SLNTools.Core.nuspec"
)
"Clean"
==> "AssemblyInfo"
==> "Build"
==> "SourceLink"
==> "NuGet"
RunTargetOrDefault "NuGet"
nuget.exe restore
if not exist packages\FAKE\tools\Fake.exe (
nuget.exe install FAKE -OutputDirectory packages -ExcludeVersion
)
if not exist packages\SourceLink.Fake\tools\Fake.fsx (
nuget.exe install SourceLink.Fake -OutputDirectory packages -ExcludeVersion -Prerelease
)
packages\FAKE\tools\FAKE.exe build.fsx %*
<?xml version="1.0"?>
<package >
<metadata>
<id>SLNTools.Core</id>
<version>1.1.2.1</version>
<authors>Christian Warren</authors>
<licenseUrl>http://slntools.codeplex.com/license</licenseUrl>
<projectUrl>http://slntools.codeplex.com</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>'Tools for SLN File' make it easier for developers to compare, merge or filter the ".sln" files generated by Visual Studio.</description>
</metadata>
<files>
<file src="CWDev.SLNTools.Core.dll" target="lib\net20" />
<file src="CWDev.SLNTools.Core.pdb" target="lib\net20" />
<file src="CWDev.SLNTools.Core.xml" target="lib\net20" />
</files>
</package>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment