提交 75d342fa 编写于 作者: N Nick Craver 提交者: GitHub

VS 2017 Build - Making things work (#766)

* Progress on VS 2017 build tooling
* Finally, a working VS 2017 tooling build
上级 67f37329
......@@ -8,6 +8,7 @@ _Resharper*
NuGet.exe
*.user
*.nupkg
.nupkgs/
.docstats
*.ide/
*.lock.json
......
......@@ -12,7 +12,10 @@
<PackageTags>orm;sql;micro-orm</PackageTags>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Dapper\Dapper.StrongName.csproj" />
<Compile Include="..\Dapper.EntityFramework\**\*.cs" Exclude="..\Dapper.EntityFramework\obj\**\*.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dapper.StrongName\Dapper.StrongName.csproj" />
<PackageReference Include="EntityFramework" Version="6.1.3" />
<PackageReference Include="Microsoft.SqlServer.Types" Version="11.0.2" />
<Reference Include="System.Configuration" />
......
......@@ -9,6 +9,9 @@
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Dapper\**\*.cs" Exclude="..\Dapper\obj\**\*.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net451' ">
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
......
......@@ -20,8 +20,9 @@
<ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" />
<ProjectReference Include="..\Dapper.SqlBuilder\Dapper.SqlBuilder.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.3.0-beta1-build3642" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta1-build1309" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta1-build3642" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
<PackageReference Include="Microsoft.Data.Sqlite" Version="1.1.0" />
......
......@@ -22,10 +22,10 @@
<ProjectReference Include="..\Dapper\Dapper.csproj" />
<ProjectReference Include="..\Dapper.Contrib\Dapper.Contrib.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="xunit.runner.console" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="System.ValueTuple" Version="4.3.0"/>
<PackageReference Include="xunit" Version="2.3.0-beta1-build3642" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta1-build1309" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta1-build3642" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
......
......@@ -11,6 +11,7 @@ public EntityFrameworkTests()
EntityFramework.Handlers.Register();
}
#if ASYNC // TODO: Temp workaround in tests
[Fact]
public void Issue570_DbGeo_HasValues()
{
......@@ -25,6 +26,7 @@ public void Issue570_DbGeo_HasValues()
fromDb.Area.IsNotNull();
fromDb.Area.IsEqualTo(orig.Area);
}
#endif
[Fact]
public void Issue22_ExecuteScalar_EntityFramework()
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A34907DF-958A-4E4C-8491-84CF303FD13E}"
ProjectSection(SolutionItems) = preProject
build.ps1 = build.ps1
build.sh = build.sh
Directory.build.props = Directory.build.props
License.txt = License.txt
Readme.md = Readme.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper", "Dapper\Dapper.csproj", "{FAC24C3F-68F9-4247-A4B9-21D487E99275}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.StrongName", "Dapper\Dapper.StrongName.csproj", "{549C51A1-222B-4E12-96F1-3AEFF45A7709}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.StrongName", "Dapper.StrongName\Dapper.StrongName.csproj", "{549C51A1-222B-4E12-96F1-3AEFF45A7709}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Tests", "Dapper.Tests\Dapper.Tests.csproj", "{052C0817-DB26-4925-8929-8C5E42D148D5}"
EndProject
......@@ -34,7 +35,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4E956F6B-6BD
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{568BD46C-1C65-4D44-870C-12CD72563262}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.EntityFramework.StrongName", "Dapper.EntityFramework\Dapper.EntityFramework.StrongName.csproj", "{39D3EEB6-9C05-4F4A-8C01-7B209742A7EB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.EntityFramework.StrongName", "Dapper.EntityFramework.StrongName\Dapper.EntityFramework.StrongName.csproj", "{39D3EEB6-9C05-4F4A-8C01-7B209742A7EB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dapper.Tests.Performance", "Dapper.Tests.Performance\Dapper.Tests.Performance.csproj", "{F017075A-2969-4A8E-8971-26F154EB420F}"
EndProject
......
......@@ -8,10 +8,10 @@
<TargetFrameworks>net40;net45;net451;netstandard1.3</TargetFrameworks>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net451' ">
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
......
......@@ -20,6 +20,15 @@
<DefaultLanguage>en-US</DefaultLanguage>
<IncludeSymbols>false</IncludeSymbols>
</PropertyGroup>
<!-- Workarounds for https://github.com/NuGet/Home/issues/4853 -->
<PropertyGroup Condition="'$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net451'">
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net451'">
<Reference Include="System.Core" Pack="false" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net451'">
<DefineConstants>$(DefineConstants);ASYNC</DefineConstants>
......@@ -30,6 +39,7 @@
<ItemGroup>
<PackageReference Include="SourceLink.Create.GitHub" Version="2.0.2" PrivateAssets="All" />
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="4.3.0-preview1-4045" PrivateAssets="All" />
<DotNetCliToolReference Include="dotnet-sourcelink" Version="2.0.2" />
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.0.2" />
</ItemGroup>
......
@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"
\ No newline at end of file
[CmdletBinding(PositionalBinding=$false)]
param(
[parameter(Position=0)][string] $PreReleaseSuffix = ''
[string] $Version,
[string] $BuildNumber,
[bool] $CreatePackages,
[bool] $RunTests = $true,
[string] $PullRequestNumber
)
function CalculateVersion() {
if ($version) {
return $version
}
$semVersion = '';
$path = $pwd;
while (!$semVersion) {
if (Test-Path (Join-Path $path "semver.txt")) {
$semVersion = Get-Content (Join-Path $path "semver.txt")
break
}
if ($PSScriptRoot -eq $path) {
break
}
$path = Split-Path $path -Parent
}
if (!$semVersion) {
Write-Error "semver.txt was not found in $pwd or any parent directory"
Exit 1
}
return "$semVersion-$BuildNumber"
}
Write-Host "Run Parameters:" -ForegroundColor Cyan
Write-Host "Version: $Version"
Write-Host "BuildNumber: $BuildNumber"
Write-Host "CreatePackages: $CreatePackages"
Write-Host "RunTests: $RunTests"
Write-Host "Base Version: $(CalculateVersion)"
$packageOutputFolder = "$PSScriptRoot\.nupkgs"
$projectsToBuild =
'Dapper',
'Dapper.StrongName',
'Dapper.Contrib',
'Dapper.EntityFramework',
'Dapper.EntityFramework.StrongName',
'Dapper.Rainbow',
'Dapper.SqlBuilder'
# Restore packages and build product
Write-Host "Restoring..." -ForegroundColor "Green"
& dotnet restore -v Minimal # Restore all packages
if ($LASTEXITCODE -ne 0)
{
throw "dotnet restore failed with exit code $LASTEXITCODE"
$testsToRun =
'Dapper.Tests',
'Dapper.Tests.Contrib'
if (!$Version -and !$BuildNumber) {
Write-Host "ERROR: You must supply either a -Version or -BuildNumber argument. `
Use -Version `"4.0.0`" for explicit version specification, or `
Use -BuildNumber `"12345`" for generation using <semver.txt>-<buildnumber>" -ForegroundColor Yellow
Exit 1
}
# Build all
Write-Host "Building..." -ForegroundColor "Green"
Get-ChildItem "Dapper*.csproj" -Recurse |
ForEach-Object {
if ($PreReleaseSuffix) {
& dotnet build "$_" --version-suffix "$PreReleaseSuffix"
} else {
& dotnet build "$_"
if ($PullRequestNumber) {
Write-Host "Building for a pull request (#$PullRequestNumber), skipping packaging." -ForegroundColor Yellow
$CreatePackages = $false
}
if ($RunTests) {
dotnet restore /ConsoleLoggerParameters:Verbosity=Quiet
foreach ($project in $testsToRun) {
Write-Host "Running tests: $project (all frameworks)" -ForegroundColor "Magenta"
Push-Location "$project"
dotnet xunit
if ($LastExitCode -ne 0) {
Write-Host "Error with tests, aborting build." -Foreground "Red"
Pop-Location
Exit 1
}
Write-Host "Tests passed!" -ForegroundColor "Green"
Pop-Location
}
}
# Run tests
Write-Host "Running Tests..." -ForegroundColor "Green"
Get-ChildItem "Dapper.Test*.csproj" -Recurse |
ForEach-Object {
& dotnet test "$_"
if ($CreatePackages) {
mkdir -Force $packageOutputFolder | Out-Null
Write-Host "Clearing existing $packageOutputFolder..." -NoNewline
Get-ChildItem $packageOutputFolder | Remove-Item
Write-Host "done." -ForegroundColor "Green"
Write-Host "Building all packages" -ForegroundColor "Green"
}
# Package all
Write-Host "Packaging..." -ForegroundColor "Green"
Get-ChildItem "Dapper*.csproj" -Recurse | Where-Object { $_.Name -NotLike "*.Tests*" } |
ForEach-Object {
if ($PreReleaseSuffix) {
& dotnet pack "$_" -c Release -o "$packageOutputFolder" --version-suffix "$PreReleaseSuffix"
} else {
& dotnet pack "$_" -c Release -o "$packageOutputFolder"
foreach ($project in $projectsToBuild) {
Write-Host "Working on $project`:" -ForegroundColor "Magenta"
Push-Location ".\$project"
$semVer = CalculateVersion
Write-Host " Restoring and packing $project... (Version:" -NoNewline -ForegroundColor "Magenta"
Write-Host $semVer -NoNewline -ForegroundColor "Cyan"
Write-Host ")" -ForegroundColor "Magenta"
$targets = "Restore"
if ($CreatePackages) {
$targets += ";Pack"
}
}
\ No newline at end of file
dotnet msbuild "/t:$targets" "/p:Configuration=Release" "/p:Version=$semVer" "/p:PackageOutputPath=$packageOutputFolder" "/p:CI=true" "/p:NuGetBuildTasksPackTargets='000'"
Pop-Location
Write-Host "Done." -ForegroundColor "Green"
Write-Host ""
}
Write-Host "Build Complete." -ForegroundColor "Green"
\ No newline at end of file
1.50.3-alpha1
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册