|
27 | 27 |
|
28 | 28 | ## License |
29 | 29 |
|
30 | | -Licensed under the [MIT License (MIT)](https://github.com/3F/vsSolutionBuildEvent/blob/master/LICENSE) |
| 30 | +Licensed under the [LGPLv3](https://github.com/3F/vsSolutionBuildEvent/blob/master/LICENSE) |
31 | 31 |
|
32 | 32 | ``` |
33 | 33 | Copyright (c) 2013-2016,2019 Denis Kuzmin < entry.reg@gmail.com > GitHub/3F |
@@ -64,8 +64,227 @@ Provides also support of the CI-Build Servers (TeamCity, AppVeyor, Azure DevOps, |
64 | 64 | [](https://vssbe.r-eg.net/doc/Scheme/) |
65 | 65 |
|
66 | 66 |
|
67 | | -* [Changelist](https://vssbe.r-eg.net/Changelist/) |
| 67 | +* [Changelog](https://vssbe.r-eg.net/Changelist/) |
68 | 68 | * [How to build](https://vssbe.r-eg.net/doc/Dev/How%20to%20build/) ([Developer Zone](https://vssbe.r-eg.net/doc/Dev/)) |
69 | 69 | * [Wiki](https://vssbe.r-eg.net/) |
70 | 70 | * [Public Bug Tracker](https://github.com/3F/vsSolutionBuildEvent/issues) |
71 | 71 |
|
| 72 | + |
| 73 | +## Advanced MSBuild |
| 74 | + |
| 75 | +https://vssbe.r-eg.net/doc/Scripts/MSBuild/ |
| 76 | + |
| 77 | +```js |
| 78 | +#[$( |
| 79 | + [System.Math]::Exp('$( |
| 80 | + [MSBuild]::Multiply( |
| 81 | + $([System.Math]::Log(10)), |
| 82 | + 4 |
| 83 | + ))' |
| 84 | + ) |
| 85 | +)] |
| 86 | +``` |
| 87 | + |
| 88 | +```js |
| 89 | +$(n = 0) $(desc = "Hello ") |
| 90 | +$(n += 3.14) $(desc += "from vsSBE !") |
| 91 | +$(n += $(n)) $(p1 = " Platform is $(Platform)") |
| 92 | +``` |
| 93 | + |
| 94 | +```js |
| 95 | +$(...) |
| 96 | +$(...:project) - from selected project in your solution |
| 97 | +$$(...) ... $$(...:project) |
| 98 | +``` |
| 99 | + |
| 100 | +```js |
| 101 | +$(tStart = $([System.DateTime]::Parse("2014/01/01").ToBinary())) |
| 102 | +$([System.Guid]::NewGuid()) |
| 103 | + |
| 104 | +$([System.TimeSpan]::FromTicks($([MSBuild]::Subtract($(tNow), $(tStart)))) |
| 105 | + .TotalHours.ToString("0")) |
| 106 | + |
| 107 | +$(pdir = $(ProjectDir:project)) |
| 108 | +$(pdir = $(ProjectDir.Replace('\', '/'):project)) |
| 109 | +``` |
| 110 | +
|
| 111 | +## SBE-Scripts |
| 112 | +
|
| 113 | +https://vssbe.r-eg.net/doc/Scripts/SBE-Scripts/ |
| 114 | +
|
| 115 | +```js |
| 116 | +#[" |
| 117 | + Basic example |
| 118 | +"] |
| 119 | +#[var v = 1.2.3] |
| 120 | +#[var log = $(TMP)/v.txt] |
| 121 | +
|
| 122 | +#[($(Configuration) ~= Deb || true) |
| 123 | +{ |
| 124 | + #[var tBase = $([System.DateTime]::Parse('2015/10/01').ToBinary())] |
| 125 | + #[var tNow = $([System.DateTime]::UtcNow.Ticks)] |
| 126 | + #[var revBuild = #[$( |
| 127 | + [System.TimeSpan]::FromTicks('$( |
| 128 | + [MSBuild]::Subtract( |
| 129 | + $(tNow), |
| 130 | + $(tBase)) |
| 131 | + )') |
| 132 | + .TotalMinutes |
| 133 | + .ToString('0'))]] |
| 134 | + |
| 135 | + #[var v = $(v).$([MSBuild]::Modulo($(revBuild), $([System.Math]::Pow(2, 14))))] |
| 136 | +}] |
| 137 | +
|
| 138 | +#[var v = $([System.String]::Format("v{0}\r\n\t", $(v)))] |
| 139 | +#[File write("#[var log]"):> Example #[var v] Generated by vsSolutionBuildEvent] |
| 140 | +#[IO scall("notepad", "#[var log]")] |
| 141 | +
|
| 142 | +$(n = $([System.Math]::Exp('$([MSBuild]::Multiply($([System.Math]::Log(2)), 16))'))) |
| 143 | +$(n) |
| 144 | +``` |
| 145 | +
|
| 146 | +For example, you can even exclude projects from build at runtime: |
| 147 | +
|
| 148 | +```js |
| 149 | +#[Build projects.find("name").IsBuildable = false] |
| 150 | +``` |
| 151 | +
|
| 152 | +Capture data from external utilities: |
| 153 | +
|
| 154 | +```js |
| 155 | +#[var bSha1 = #[IO sout("git", "rev-parse --short HEAD")]] |
| 156 | +``` |
| 157 | +
|
| 158 | +Work with files and archives: |
| 159 | +
|
| 160 | +```js |
| 161 | +#[IO copy.file("$(odir)/notes.txt", "$(pDirCIM)bin\\$(cfg)\\", true)] |
| 162 | +#[7z pack.files({ |
| 163 | + "$(pDirBridge)bin\$(cfg)\Bridge.*.*", |
| 164 | + "CI.MSBuild.dll", |
| 165 | + "CI.MSBuild.pdb", |
| 166 | + "$(pDirCIM)bin\$(cfg)\*.txt"}, "$(odir)CI.MSBuild_v$(numCIM)_[$(branchSha1)][$(netStamp)].zip")] |
| 167 | +
|
| 168 | +``` |
| 169 | +
|
| 170 | ++DTE-commands, +Access to all MSBuild properties on the fly, +Conditional statements and lot of other components: |
| 171 | +
|
| 172 | +```js |
| 173 | +#[try |
| 174 | +{ |
| 175 | + #[Box iterate(i = 0; $(i) < 10; i += 1): |
| 176 | + ... |
| 177 | + ] |
| 178 | +}catch{ }] |
| 179 | +
|
| 180 | +#[( #[vsSBE events.Pre.item(1).Enabled] || ($(Configuration) == "Release" && $(sysc)) ) |
| 181 | +{ |
| 182 | + #[Build projects.find("name").IsBuildable = false] |
| 183 | +} |
| 184 | +else |
| 185 | +{ |
| 186 | + #[var bSha1 = #[IO sout("git", "rev-parse --short HEAD")]] |
| 187 | + ... |
| 188 | +}] |
| 189 | +``` |
| 190 | +
|
| 191 | +... [create **new** in 5 minutes](https://vssbe.r-eg.net/doc/Dev/New%20Component/) |
| 192 | +
|
| 193 | +## Processing modes |
| 194 | +
|
| 195 | +https://vssbe.r-eg.net/doc/Modes/ |
| 196 | +
|
| 197 | +From simple commands to C# or even msbuild targets: |
| 198 | +
|
| 199 | +```xml |
| 200 | +<?xml version="1.0" encoding="utf-8"?> |
| 201 | +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 202 | +
|
| 203 | + <Target Name="Init"> |
| 204 | + <!-- ... --> |
| 205 | + </Target> |
| 206 | +
|
| 207 | + <!-- |
| 208 | + Additional properties: |
| 209 | + $(ActionName) |
| 210 | + $(BuildType) |
| 211 | + $(EventType) |
| 212 | + $(SupportMSBuild) |
| 213 | + $(SupportSBEScripts) |
| 214 | + $(SolutionActiveCfg) |
| 215 | + $(StartupProject) |
| 216 | + --> |
| 217 | +</Project> |
| 218 | +``` |
| 219 | +
|
| 220 | +## CommandEvent (DTE) |
| 221 | +
|
| 222 | +You can also use this to catch all command from VS IDE. [Samples:](https://vssbe.r-eg.net/doc/Events/CommandEvent/) |
| 223 | +
|
| 224 | +```js |
| 225 | +$(lcGuid = #[DTE events.LastCommand.Guid]) |
| 226 | +$(lcId = #[DTE events.LastCommand.Id]) |
| 227 | +
|
| 228 | +#[($(lcGuid) == "{1496A755-94DE-11D0-8C3F-00C04FC2AAE2}" && $(lcId) == 1627) { |
| 229 | + #[File scall("notepad", "#[var log]", 30)] |
| 230 | +}] |
| 231 | +``` |
| 232 | +
|
| 233 | + |
| 234 | +
|
| 235 | +## Automatic Version Numbering |
| 236 | +
|
| 237 | +See our [**Wizard** for automatic code generation **or** use any **custom scripts**.](https://vssbe.r-eg.net/doc/Examples/Version/) |
| 238 | +
|
| 239 | + |
| 240 | +
|
| 241 | +## Different environments |
| 242 | +
|
| 243 | +You can easily use this with TeamCity, Azure DevOps, AppVeyor, and any other automated environments: |
| 244 | +
|
| 245 | + |
| 246 | +
|
| 247 | + |
| 248 | +
|
| 249 | + |
| 250 | +
|
| 251 | + |
| 252 | +
|
| 253 | +... |
| 254 | +
|
| 255 | +## Solution-wide Build events |
| 256 | +
|
| 257 | +Pre-Build / Post-Build events for all projects at once or individually for each separately: [configure what you need.](https://vssbe.r-eg.net/doc/Features/Solution-wide/) |
| 258 | +
|
| 259 | + |
| 260 | +
|
| 261 | +## Stop build on first error |
| 262 | +
|
| 263 | +[Immediately stop](http://vssbe.r-eg.net/doc/Examples/Errors.Stop%20build/) (at the same time) after the first appearance (compared with StopOnFirstBuildError plugin [[?]](http://vssbe.r-eg.net/doc/Examples/Errors.Stop%20build/)) |
| 264 | +
|
| 265 | + |
| 266 | +
|
| 267 | +## Wiki |
| 268 | +
|
| 269 | +[Wiki](http://vssbe.r-eg.net/) - Contains help for work with plugins, basic examples, syntax, information for develop, and lot of other... |
| 270 | +
|
| 271 | +Feel free to improve any our pages. Click [Edit] button or [Start new here.](http://vssbe.r-eg.net/doc/New/) |
| 272 | +
|
| 273 | +
|
| 274 | +## Questions / Bugs / Suggestions / Source Code |
| 275 | +
|
| 276 | +Welcome: |
| 277 | +
|
| 278 | +* https://github.com/3F/vsSolutionBuildEvent |
| 279 | +
|
| 280 | +## Screenshots |
| 281 | +
|
| 282 | + |
| 283 | +
|
| 284 | + |
| 285 | +
|
| 286 | + |
| 287 | +
|
| 288 | + |
| 289 | +
|
| 290 | +[**[. . .](https://vssbe.r-eg.net/Screenshots/)**] |
0 commit comments