@@ -19,9 +19,13 @@ public override void Run(BuildContext context)
1919 if ( context . Version == null )
2020 return ;
2121 var version = context . Version . NugetVersion ;
22+ var fullSemVer = context . Version . GitVersion . FullSemVer ;
2223
2324 var nugetSource = context . MakeAbsolute ( Paths . Nuget ) . FullPath ;
2425
26+ const int toolVersionValue = 11 ; // Workaround for now. It should be removed when https://github.com/cake-build/cake/issues/4658 is merged
27+ var isMsBuildToolVersionValid = Enum . IsDefined ( typeof ( MSBuildToolVersion ) , toolVersionValue ) ;
28+
2529 context . Information ( "\n Testing msbuild task with dotnet build\n " ) ;
2630 foreach ( var netVersion in Constants . DotnetVersions )
2731 {
@@ -40,7 +44,27 @@ public override void Run(BuildContext context)
4044 } ) ;
4145
4246 var exe = Paths . Integration . Combine ( "build" ) . Combine ( framework ) . CombineWithFilePath ( "app.dll" ) ;
43- context . ValidateOutput ( "dotnet" , exe . FullPath , context . Version . GitVersion . FullSemVer ) ;
47+ context . ValidateOutput ( "dotnet" , exe . FullPath , fullSemVer ) ;
48+
49+ if ( ! isMsBuildToolVersionValid ) continue ;
50+
51+ const MSBuildToolVersion toolVersion = ( MSBuildToolVersion ) toolVersionValue ;
52+ context . Information ( "\n Testing msbuild task with msbuild (for full framework)\n " ) ;
53+
54+ var msBuildSettings = new MSBuildSettings
55+ {
56+ Verbosity = Verbosity . Minimal ,
57+ ToolVersion = toolVersion ,
58+ Restore = true
59+ } ;
60+
61+ msBuildSettings . WithProperty ( "GitVersionMsBuildVersion" , version ) ;
62+ msBuildSettings . WithProperty ( "RestoreSource" , nugetSource ) ;
63+
64+ context . MSBuild ( projPath . FullPath , msBuildSettings ) ;
65+
66+ var fullExe = Paths . Integration . Combine ( "build" ) . CombineWithFilePath ( "app.exe" ) ;
67+ context . ValidateOutput ( fullExe . FullPath , null , fullSemVer ) ;
4468 }
4569 }
4670}
0 commit comments