lholman / OneBuild

Convention based PowerShell build for .NET http://lholman.github.io/OneBuild/
Apache License 2.0
17 stars 2 forks source link

When running Build.bat for the first time error 'No VersionNumber.xml file found' is thrown #3

Closed lholman closed 10 years ago

lholman commented 10 years ago

After installing OneBuild via NuGet and running Build.bat from the solution root the following error is thrown

C:\Development\ConsoleApplication1>Build.bat
 0
task = Invoke-Commit
configuration = Debug
buildcounter = 999
Build Invoke-Commit C:\Development\ConsoleApplication1\OneBuild.build.ps1
Base module path: C:\Development\ConsoleApplication1\packages\OneBuild.1.0.100\
tools\powershell\modules
Task /Invoke-Commit/Invoke-Compile/Invoke-HardcoreClean
Searching for paths to delete, recursively from: C:\Development\ConsoleApplicati
on1
Cleaning: C:\Development\ConsoleApplication1\ConsoleApplication1\bin
Cleaning: C:\Development\ConsoleApplication1\ConsoleApplication1\obj
0
Done /Invoke-Commit/Invoke-Compile/Invoke-HardcoreClean 00:00:00.4720472
Task /Invoke-Commit/Invoke-Compile/Set-VersionNumber/Read-MajorMinorVersionNumb
er/New-DefaultVersionNumberXmlFile skipped.
Task /Invoke-Commit/Invoke-Compile/Set-VersionNumber/Read-MajorMinorVersionNumb
er
At C:\Development\ConsoleApplication1\OneBuild.build.ps1:125 char:1
+ task Read-MajorMinorVersionNumber -If { ($major -eq $null) -and ($minor -eq $
nul 
+ 
At C:\Development\ConsoleApplication1\OneBuild.build.ps1:115 char:1
+ task Set-VersionNumber Read-MajorMinorVersionNumber, {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At C:\Development\ConsoleApplication1\OneBuild.build.ps1:96 char:1
+ task Invoke-Compile Invoke-HardcoreClean, Set-VersionNumber, {
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At C:\Development\ConsoleApplication1\OneBuild.build.ps1:43 char:1
+ task Invoke-Commit Invoke-Compile, Invoke-UnitTests, New-Packages, Undo-Check
edO ...
+ 
Build FAILED. 5 tasks, 4 errors, 0 warnings 00:00:00.9260926
C:\Development\ConsoleApplication1\packages\invoke-build.2.9.12\tools\Invoke-Bu
ild.ps1 : No C:\Development\ConsoleApplication1\VersionNumber.xml file found.
Maybe you've forgotten to check it in?
At line:1 char:1
+ .\packages\invoke-build.2.9.12\tools\Invoke-Build.ps1 Invoke-Commit
-configurati ...
+ 
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorExcep
   tion
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
   n,Invoke-Build.ps1
##teamcity[buildStatus status='FAILURE' text='{build.status.text} in execution']
C:\Development\ConsoleApplication1>
lholman commented 10 years ago

Ok, this is a bug in the OneBuild.build.ps1 Read-MajorMinorVersionNumber task. A work around is to manually create a VersionNumber.xml next to the Build.bat OneBuild.build.ps1 in the solution root. An example VersionNumber.xml can be found here https://github.com/lholman/OneBuild/blob/master/VersionNumber.xml