Skip to content

Commit 47f2d4c

Browse files
committed
added net472 msbuild testing of the artifacts
1 parent b10f4ee commit 47f2d4c

File tree

7 files changed

+129
-21
lines changed

7 files changed

+129
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,4 @@ config.wyam.dll
125125
config.wyam.hash
126126
config.wyam.packages.xml
127127
/test/core/build
128+
/test/full/build

build/artifacts-test.cake

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,55 @@ Task("Artifacts-MsBuildCore-Test")
4848
}
4949
});
5050

51+
Task("Artifacts-MsBuildFull-Test")
52+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnWindows, "Artifacts-MsBuildFull-Test can be tested only on Windows agents.")
53+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsReleasingCI, "Artifacts-MsBuildFull-Test works only on Releasing CI.")
54+
.IsDependentOnWhen("Pack-Nuget", singleStageRun)
55+
.Does<BuildParameters>((parameters) =>
56+
{
57+
var version = parameters.Version.NugetVersion;
58+
59+
var nugetSource = MakeAbsolute(parameters.Paths.Directories.NugetRoot).FullPath;
60+
61+
Information("\nTesting msbuild task with dotnet build (for .net core)\n");
62+
var frameworks = new[] { parameters.CoreFxVersion21, parameters.CoreFxVersion31 };
63+
foreach(var framework in frameworks)
64+
{
65+
var dotnetCoreMsBuildSettings = new DotNetCoreMSBuildSettings();
66+
dotnetCoreMsBuildSettings.WithProperty("TargetFramework", framework);
67+
dotnetCoreMsBuildSettings.WithProperty("GitVersionTaskVersion", version);
68+
69+
var projPath = MakeAbsolute(new DirectoryPath("./test/core"));
70+
71+
DotNetCoreBuild(projPath.FullPath, new DotNetCoreBuildSettings
72+
{
73+
Verbosity = DotNetCoreVerbosity.Minimal,
74+
Configuration = parameters.Configuration,
75+
MSBuildSettings = dotnetCoreMsBuildSettings,
76+
ArgumentCustomization = args => args.Append($"--source {nugetSource}")
77+
});
78+
79+
var netcoreExe = new DirectoryPath("./test/core/build").Combine(framework).CombineWithFilePath("app.dll");
80+
ValidateOutput("dotnet", netcoreExe.FullPath, parameters.Version.GitVersion.FullSemVer);
81+
}
82+
83+
Information("\nTesting msbuild task with msbuild (for full framework)\n");
84+
85+
var msBuildSettings = new MSBuildSettings
86+
{
87+
Verbosity = Verbosity.Minimal,
88+
Restore = true
89+
};
90+
91+
msBuildSettings.WithProperty("GitVersionTaskVersion", version);
92+
msBuildSettings.WithProperty("RestoreSource", nugetSource);
93+
94+
MSBuild("./test/full", msBuildSettings);
95+
96+
var fullExe = new DirectoryPath("./test/full/build").CombineWithFilePath("app.exe");
97+
ValidateOutput(fullExe.FullPath, null, parameters.Version.GitVersion.FullSemVer);
98+
});
99+
51100
Task("Artifacts-Test")
52101
.WithCriteria<BuildParameters>((context, parameters) => !parameters.IsRunningOnMacOS, "Artifacts-Test can be tested only on Windows or Linux agents.")
53102
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsReleasingCI, "Artifacts-Test works only on Releasing CI.")

test/Directory.Build.props

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<PropertyGroup>
5+
<OutputType>Exe</OutputType>
6+
<RootNamespace>App</RootNamespace>
7+
<AssemblyName>app</AssemblyName>
8+
<OutputPath>.\build\</OutputPath>
9+
<RestoreAdditionalProjectSources>
10+
https://api.nuget.org/v3/index.json
11+
</RestoreAdditionalProjectSources>
12+
</PropertyGroup>
13+
<ItemGroup>
14+
<Compile Include="..\Program.cs" />
15+
</ItemGroup>
16+
<ItemGroup>
17+
<PackageReference Include="GitVersionTask" Version="$(GitVersionTaskVersion)">
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
</PackageReference>
21+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
22+
</ItemGroup>
23+
24+
</Project>

test/Directory.Build.targets

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<Target Name="Git" DependsOnTargets="GetVersion">
5+
<Message Text="Repo sha: $(GitVersion_Sha)" Importance="high" />
6+
<Message Text="Repo version: $(GitVersion_FullSemVer)" Importance="high" />
7+
</Target>
8+
9+
</Project>
File renamed without changes.

test/core/app.csproj

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<AssemblyName>app</AssemblyName>
6-
<RootNamespace>App</RootNamespace>
7-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8-
<GitVersionTaskVersion Condition=" '$(GitVersionTaskVersion)' == '' ">5.0.0-beta5.53</GitVersionTaskVersion>
9-
<OutputPath>.\build\</OutputPath>
10-
</PropertyGroup>
11-
12-
<Target Name="Git" DependsOnTargets="GetVersion">
13-
<Message Text="Repo sha: $(GitVersion_Sha)" Importance="high" />
14-
<Message Text="Repo version: $(GitVersion_FullSemVer)" Importance="high" />
15-
</Target>
16-
17-
<ItemGroup>
18-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" />
19-
<PackageReference Include="GitVersionTask" Version="$(GitVersionTaskVersion)">
20-
<PrivateAssets>all</PrivateAssets>
21-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
22-
</PackageReference>
23-
</ItemGroup>
3+
<PropertyGroup>
4+
<!-- <TargetFrameworks>netcoreapp2.1;netcoreapp3.1</TargetFrameworks> -->
5+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
6+
</PropertyGroup>
247

258
</Project>

test/full/app.csproj

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{C1765652-F8AE-4FFD-AFC8-72054A5A91B7}</ProjectGuid>
8+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
9+
<FileAlignment>512</FileAlignment>
10+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
11+
<Deterministic>true</Deterministic>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14+
<PlatformTarget>AnyCPU</PlatformTarget>
15+
<DebugSymbols>true</DebugSymbols>
16+
<DebugType>full</DebugType>
17+
<Optimize>false</Optimize>
18+
<DefineConstants>DEBUG;TRACE</DefineConstants>
19+
<ErrorReport>prompt</ErrorReport>
20+
<WarningLevel>4</WarningLevel>
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23+
<PlatformTarget>AnyCPU</PlatformTarget>
24+
<DebugType>pdbonly</DebugType>
25+
<Optimize>true</Optimize>
26+
<DefineConstants>TRACE</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
</PropertyGroup>
30+
<ItemGroup>
31+
<Reference Include="System" />
32+
<Reference Include="System.Core" />
33+
<Reference Include="System.Xml.Linq" />
34+
<Reference Include="System.Data.DataSetExtensions" />
35+
<Reference Include="Microsoft.CSharp" />
36+
<Reference Include="System.Data" />
37+
<Reference Include="System.Net.Http" />
38+
<Reference Include="System.Xml" />
39+
</ItemGroup>
40+
41+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
42+
</Project>

0 commit comments

Comments
 (0)