Last active
January 25, 2016 20:42
-
-
Save 3F/3f2f56dfc2a01dc99c63 to your computer and use it in GitHub Desktop.
Full script for assembling the vsSolutionBuildEvent v0.12.6+ :: https://visualstudiogallery.msdn.microsoft.com/0d1dbfd7-ed8a-40af-ae39-281bfeca2334/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[" | |
To restore packages with GetNuTool | |
It's important for packages of solution-level in VS2015 | |
https://github.com/NuGet/Home/issues/522 | |
"] | |
#[($([System.Convert]::ToInt32("$(VisualStudioVersion.Replace('.', ''))")) >= 140) | |
{ | |
#[NuGet gnt.raw("/p:ngconfig=\".nuget/packages.config\"")] | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[" | |
Prepares data - versions, revBuild & information from git | |
"] | |
#[var tStart = $([System.DateTime]::Parse("2016/01/21").ToBinary())] | |
#[var tNow = $([System.DateTime]::UtcNow.Ticks)] | |
#[var revBuild = $([System.TimeSpan]::FromTicks($([MSBuild]::Subtract($(tNow), $(tStart)))).TotalMinutes.ToString("0"))] | |
#[var tplVersion = #[File get("Version.tpl")]] | |
#[var pDir = vsSolutionBuildEvent/] | |
#[var pDirBridge = Bridge/] | |
#[var pDirCIM = CI.MSBuild/] | |
#[var pDirDevenv = Devenv\] | |
#[var pDirProvider = Provider/] | |
#[var numSBE = #[File get(".version")]] | |
#[var numBridge = #[File get("#[var pDirBridge].version")]] | |
#[var numCIM = #[File get("#[var pDirCIM].version")]] | |
#[var numDevenv = #[File get("#[var pDirDevenv].version")]] | |
#[var numProvider = #[File get("#[var pDirProvider].version")]] | |
#[" the 0 number is reserved for patches from external assemblies /see AssemblyInfo "] | |
#[var num0Bridge = #[var numBridge].0] | |
#[var num0CIM = #[var numCIM].0] | |
#[var num0Devenv = #[var numDevenv].0] | |
#[var num0Provider = #[var numProvider].0] | |
#[var libCore = #[var numSBE]] | |
#[var libCoreInt = $([System.Convert]::ToInt32("$(libCore.Replace('.', '0'))"))]#[" v0.12.5 -> 1205 "] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[( #[File exists.directory(".git")] && #[File exists.file("git.exe", true)] ) | |
{ | |
#[var branchSha1 = #[File sout("git", "rev-parse --short HEAD")]] | |
#[var branchName = #[File sout("git", "rev-parse --abbrev-ref HEAD")]] | |
#[var branchRevCount = #[File sout("git", "rev-list HEAD --count")]] | |
#[var csVersion = $(tplVersion.Replace(%branchName%, "$(branchName)").Replace(%branchSha1%, "$(branchSha1)").Replace(%branchRevCount%, "$(branchRevCount)"))] | |
#[($(branchName) == "HEAD") { | |
#[var branchName = $(APPVEYOR_REPO_BRANCH)] | |
}] | |
} | |
else { | |
#[var csVersion = $(tplVersion.Replace(%branchName%, "-").Replace(%branchSha1%, "-").Replace(%branchRevCount%, "-"))] | |
}] | |
#[" | |
Updating version for 'vsSolutionBuildEvent'. | |
Note: | |
* For getting the main project path, sample: | |
#[var pDir = $($(ProjectDir:$(SolutionName)))] | |
"] | |
#[var cs = $(csVersion.Replace(%Version%, "$(numSBE.Replace('.', ', ')), $(revBuild)").Replace(%namespace%, ""))] | |
#[var cs = $(cs.Replace(%VersionRevString%, "$(numSBE).$(revBuild)").Replace(%VersionString%, "$(numSBE)"))] | |
#[File write("#[var pDir]Version.cs"):#[var cs]] | |
#[" | |
.vsixmanifest | |
"] | |
#[($(Configuration) ~= "_with_revision" || $(Configuration) ~= "CI_") { | |
#[var numSBE = #[var numSBE].#[var revBuild]] | |
}] | |
#[File replace.Regexp("#[var pDir]/source.extension.vsixmanifest", "<Version>[0-9.]+</Version>", "<Version>#[var numSBE]</Version>")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[" | |
Updating version for 'Bridge'. | |
"] | |
#[var cs = $(csVersion.Replace(%Version%, "$(num0Bridge.Replace('.', ', ')), $(revBuild)").Replace(%namespace%, ".Bridge"))] | |
#[var cs = $(cs.Replace(%VersionRevString%, "$(num0Bridge).$(revBuild)").Replace(%VersionString%, "$(num0Bridge)"))] | |
#[File write("#[var pDirBridge]Version.cs"):#[var cs]] | |
#[" | |
Updating version for 'CI.MSBuild'. | |
"] | |
#[var cs = $(csVersion.Replace(%Version%, "$(num0CIM.Replace('.', ', ')), $(revBuild)").Replace(%namespace%, ".CI.MSBuild"))] | |
#[var cs = $(cs.Replace(%VersionRevString%, "$(num0CIM).$(revBuild)").Replace(%VersionString%, "$(num0CIM)"))] | |
#[File write("#[var pDirCIM]Version.cs"):#[var cs]] | |
#[" | |
Updating version for 'Devenv'. | |
"] | |
#[var cs = $(csVersion.Replace(%Version%, "$(num0Devenv.Replace('.', ', ')), $(revBuild)").Replace(%namespace%, ".Devenv"))] | |
#[var cs = $(cs.Replace(%VersionRevString%, "$(num0Devenv).$(revBuild)").Replace(%VersionString%, "$(num0Devenv)"))] | |
#[File write("#[var pDirDevenv]Version.cs"):#[var cs]] | |
#[" | |
Updating version for 'Provider'. | |
"] | |
#[var cs = $(csVersion.Replace(%Version%, "$(num0Provider.Replace('.', ', ')), $(revBuild)").Replace(%namespace%, ".Provider"))] | |
#[var cs = $(cs.Replace(%VersionRevString%, "$(num0Provider).$(revBuild)").Replace(%VersionString%, "$(num0Provider)"))] | |
#[File write("#[var pDirProvider]Version.cs"):#[var cs]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[($([System.Convert]::ToInt32("$(VisualStudioVersion.Replace('.', ''))")) < 120) { | |
#[($(Configuration) ^= "Release" && !$(Configuration) ^= "CI_") { | |
#[DTE exec: Test.RunAllTestsInSolution] | |
}] | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[var odir = $(SolutionDir)bin/Releases/] | |
#[var cfg = #[($(Configuration) ~= "Release"){Release}else{Debug}]] | |
#[var cfgFull = $(Configuration)] | |
#[var vsixLib = $(SolutionDir)VsixLib\bin\] | |
#[var CIMLib = $(SolutionDir)CIMLib\bin\] | |
#[var netStamp = net$(TargetFrameworkVersion.Replace(".", "").Replace("v", ""))] | |
#[var netVerString = $(TargetFrameworkVersion)#[($(TargetFrameworkVersion) != v4.0){ (be careful - for complete compatibility with VS2010 it should be v4.0)}]] | |
#[var msbuildver = v$(MSBuildToolsVersion)] | |
#[IO delete.directory("$(odir)", true)] | |
#[IO copy.directory("", "$(odir)", true)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[File write("$(odir)\Release_notes.txt"):This assembled from: | |
* Configuration: '#[var cfgFull]' (Folders: #[var cfg]) | |
* .NET version: #[var netVerString]; | |
* MSBuild Tools: #[var msbuildver]; | |
* Build number: #[var revBuild]; | |
* Branch Sha1: #[var branchSha1]; | |
* Branch Name: #[var branchName]; | |
* Branch revCount: #[var branchRevCount]; | |
------------------------------------------ | |
Versions: | |
* The 'Bridge': v#[var numBridge]; | |
* The 'CI.MSBuild': v#[var numCIM]; | |
* The 'Devenv': v#[var numDevenv]; | |
* The 'Provider': v#[var numProvider]; | |
* The 'vsSolutionBuildEvent': v#[var numSBE]; | |
Packages: | |
* NuGet 'vsSBE.CI.MSBuild': v#[var numCIM].#[var libCoreInt]; | |
Demo: | |
* ClientDemo - [#[var branchSha1]][#[var netStamp]](#[var revBuild]) | |
------------------------------------------ | |
Generated by vsSolutionBuildEvent | |
------------------------------------------ | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[IO copy.file("$(odir)\Release_notes.txt", "$(pDirBridge)bin\$(cfg)\\", true)] | |
#[7z pack.files({ | |
"$(pDirBridge)bin\$(cfg)\Bridge.dll", | |
"$(pDirBridge)bin\$(cfg)\Bridge.pdb", | |
"$(pDirBridge)bin\$(cfg)\Release_notes.txt" }, "$(odir)Bridge_v$(numBridge)_[$(branchSha1)][$(netStamp)].zip")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[IO copy.file("$(odir)\Release_notes.txt", "$(pDirProvider)bin\$(cfg)\\", true)] | |
#[7z pack.files({ | |
"$(pDirProvider)bin\$(cfg)\Bridge.dll", | |
"$(pDirProvider)bin\$(cfg)\Bridge.pdb", | |
"$(pDirProvider)bin\$(cfg)\Provider.dll", | |
"$(pDirProvider)bin\$(cfg)\Provider.pdb", | |
"$(pDirProvider)bin\$(cfg)\Release_notes.txt" }, "$(odir)Provider_v$(numProvider)_[$(branchSha1)][$(netStamp)].zip")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[IO copy.file("$(odir)\Release_notes.txt", "$(pDirCIM)bin\$(cfg)\\", true)] | |
#[7z pack.files({ | |
"$(pDirCIM)bin\$(cfg)\Bridge.dll", | |
"$(pDirCIM)bin\$(cfg)\Bridge.pdb", | |
"$(pDirCIM)bin\$(cfg)\Provider.dll", | |
"$(pDirCIM)bin\$(cfg)\Provider.pdb", | |
"$(pDirCIM)bin\$(cfg)\CI.MSBuild.dll", | |
"$(pDirCIM)bin\$(cfg)\CI.MSBuild.pdb", | |
"$(pDirCIM)bin\$(cfg)\Release_notes.txt"}, "$(odir)CI.MSBuild_v$(numCIM)_[$(branchSha1)][$(netStamp)].zip")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[var _DP = $(SolutionDir)$(pDirDevenv)bin\#[var cfg]\] | |
#[IO delete.directory("$(_DP)Devenv", true)] | |
#[IO copy.directory("", "$(_DP)Devenv", true)] | |
#[IO copy.file("$(_DP)Bridge.*", "$(_DP)Devenv\\", true)] | |
#[IO copy.file("$(_DP)Provider.*", "$(_DP)Devenv\\", true)] | |
#[IO copy.file("$(_DP)Devenv.*", "$(_DP)Devenv\\", true, {"Devenv.AddIn"})] | |
#[( #[IO exists.file("$(_DP)Extensibility.dll")] ) { | |
#[IO copy.file("$(_DP)Extensibility.dll", "$(_DP)\Devenv\\", true)] | |
}] | |
#[IO copy.file("$(odir)\Release_notes.txt", "$(_DP)Devenv\\", true)] | |
#[7z pack.files({"$(_DP)Devenv.AddIn", "$(_DP)Devenv\*.*"}, "$(odir)Devenv_v$(numDevenv)_[$(branchSha1)][$(netStamp)].zip")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[IO copy.file("$(pDir)bin\$(cfg)\vsSolutionBuildEvent.vsix", "$(odir)vsSolutionBuildEvent_v$(numSBE)_[$(branchSha1)][$(netStamp)].vsix", true)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[var tplNuspec = #[File get("vsSBE.CI.MSBuild.nuspec.tpl")]] | |
#[var nupCIMdir = $(odir)NuGet-CI.MSBuild-package] | |
#[IO delete.directory("$(nupCIMdir)", true)] | |
#[IO copy.directory("", "$(nupCIMdir)", true)] | |
#[var nuspec = $(tplNuspec.Replace("%CIM%", "$(numCIM)").Replace("%Lib%", "$(libCoreInt)").Replace("%vsSBE%", "$(numSBE)"))] | |
#[File write("$(nupCIMdir)\vsSBE.CI.MSBuild.nuspec"):#[var nuspec]] | |
#[" files for package "] | |
#[IO copy.file("$(CIMLib)\*.dll", "$(nupCIMdir)\bin\\", true)]#[" CIMLib custom "] | |
#[" vsix dir "] | |
#[IO copy.file("$(pDir)bin/$(cfg)\*.dll", "$(nupCIMdir)\bin\\", true)] | |
#[IO copy.file("$(pDirCIM)bin/$(cfg)\*.dll", "$(nupCIMdir)\bin\\", true)] | |
#[IO copy.file("$(odir)\Release_notes.txt", "$(nupCIMdir)\bin\\", true)] | |
#[IO copy.file("3rd-party", "$(nupCIMdir)\bin\\", true)] | |
#[IO copy.file("changelog.txt", "$(nupCIMdir)\bin\\", true)] | |
#[IO copy.file("LICENSE", "$(nupCIMdir)\bin\\", true)] | |
#[NuGet gnt.raw("gnt.core /t:pack /p:ngin=\"$(nupCIMdir)\" /p:ngout=\"$(odir)\"")] | |
#[IO delete.directory("$(nupCIMdir)", true)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[var clientDemoDir = ClientDemo\bin\#[var cfg]\] | |
#[7z pack.files({ | |
"$(clientDemoDir)Bridge.dll", | |
"$(clientDemoDir)Bridge.pdb", | |
"$(clientDemoDir)client.vssbe.dll", | |
"$(clientDemoDir)client.vssbe.pdb"}, "$(odir)ClientDemo_[$(branchSha1)][$(netStamp)]($(revBuild)).zip")] |
Results for samples above:
This assembled from:
* Configuration: 'CI_Debug' (Folders: Debug)
* .NET version: v4.0;
* MSBuild Tools: v12.0;
* Build number: 5585;
* Branch Sha1: df66438;
* Branch Name: master;
* Branch revCount: 323;
------------------------------------------
Versions:
* The 'Bridge': v1.3;
* The 'CI.MSBuild': v1.5;
* The 'Devenv': v1.3;
* The 'Provider': v3.0;
* The 'vsSolutionBuildEvent': v0.12.6.5585;
Packages:
* NuGet 'vsSBE.CI.MSBuild': v1.5.1206;
Demo:
* ClientDemo - [df66438][net40](5585)
------------------------------------------
Generated by vsSolutionBuildEvent
------------------------------------------
http://vssbe.r-eg.net
http://vssbe.r-eg.net/Changelist/
http://vssbe.r-eg.net/Downloads/
http://visualstudiogallery.msdn.microsoft.com/0d1dbfd7-ed8a-40af-ae39-281bfeca2334/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
full script file: https://github.com/3F/vsSolutionBuildEvent/blob/master/.vssbe