mirror of
https://github.com/DapperLib/Dapper.git
synced 2026-10-17 05:12:13 +08:00
workaround for https://github.com/NuGet/Home/issues/4853
This commit is contained in:
+2
-1
@@ -15,4 +15,5 @@ NuGet.exe
|
||||
Test.DB.*
|
||||
TestResults/
|
||||
Dapper.Tests/*.sdf
|
||||
.dotnet/*
|
||||
.dotnet/*
|
||||
.vscode/*
|
||||
@@ -16,8 +16,12 @@
|
||||
<ProjectReference Include="..\Dapper\Dapper.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' ">
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.Linq" />
|
||||
<Reference Include="System.Data">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.Linq">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -15,10 +15,18 @@
|
||||
<ProjectReference Include="..\Dapper\Dapper.StrongName.csproj" />
|
||||
<PackageReference Include="EntityFramework" Version="6.1.3" />
|
||||
<PackageReference Include="Microsoft.SqlServer.Types" Version="11.0.2" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.Linq">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -12,10 +12,18 @@
|
||||
<ProjectReference Include="..\Dapper\Dapper.csproj" />
|
||||
<PackageReference Include="EntityFramework" Version="6.1.3" />
|
||||
<PackageReference Include="Microsoft.SqlServer.Types" Version="11.0.2" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.Linq">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -14,8 +14,12 @@
|
||||
<ProjectReference Include="..\Dapper\Dapper.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' ">
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.Linq" />
|
||||
<Reference Include="System.Data">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.Linq">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">
|
||||
<DefineConstants>$(DefineConstants);COREFX;</DefineConstants>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<GenerateDocumentationFile>false</GenerateDocumentationFile>
|
||||
<TargetFrameworks>net462</TargetFrameworks>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dapper\Dapper.csproj" />
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
|
||||
<TargetFrameworks>net452;netcoreapp1.0</TargetFrameworks>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
|
||||
|
||||
@@ -10,9 +10,15 @@
|
||||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net451' ">
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -8,9 +8,15 @@
|
||||
<TargetFrameworks>net40;net45;net451;netstandard1.3</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net45' OR '$(TargetFramework)' == 'net451' ">
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<NuSpecFrameworkAssembly>true</NuSpecFrameworkAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -33,4 +33,66 @@
|
||||
<DotNetCliToolReference Include="dotnet-sourcelink" Version="2.0.2" />
|
||||
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
This is a temporary workaround for Nuget Issue #4853 - https://github.com/NuGet/Home/issues/4853#issuecomment-292719597
|
||||
Ideally this belongs into Directory.build.targets, but that doesn't work either - https://github.com/Microsoft/msbuild/issues/1721
|
||||
-->
|
||||
<Target Name="_CleanNuSpec" DependsOnTargets="_GenerateProjectRestoreGraph">
|
||||
<PropertyGroup>
|
||||
<_NuSpecPrefix>$(RestoreOutputAbsolutePath)$(_RestoreProjectName).$(_RestoreProjectVersion)</_NuSpecPrefix>
|
||||
<_NuSpec>$(_NuSpecPrefix).nuspec</_NuSpec>
|
||||
<_NuSpecPatched>$(_NuSpecPrefix).patched.nuspec</_NuSpecPatched>
|
||||
</PropertyGroup>
|
||||
<Delete Files="$(_NuSpec)" Condition="Exists('$(_NuSpec)')" />
|
||||
<Delete Files="$(_NuSpecPatched)" Condition="Exists('$(_NuSpecPatched)')" />
|
||||
</Target>
|
||||
<Target Name="_ExtractReferences">
|
||||
<ItemGroup>
|
||||
<_ExtractReferenceTarget Include="$(TargetFrameworks)" />
|
||||
</ItemGroup>
|
||||
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="ExtractReferencesPerTarget" Properties="TargetFramework=%(_ExtractReferenceTarget.Identity)">
|
||||
<Output TaskParameter="TargetOutputs" ItemName="_Reference" />
|
||||
</MSBuild>
|
||||
</Target>
|
||||
<Target Name="ExtractReferencesPerTarget" Outputs="@(_AssemblyReference)">
|
||||
<ItemGroup>
|
||||
<_AssemblyReference Include="@(Reference)" Condition="'%(Reference.NuSpecFrameworkAssembly)' == 'true'">
|
||||
<NuSpecFrameworkAssembly>$(TargetFramework)</NuSpecFrameworkAssembly>
|
||||
</_AssemblyReference>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
<UsingTask TaskName="AddFrameworkAssemblies" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
|
||||
<ParameterGroup>
|
||||
<NuSpecFile ParameterType="System.String" Required="true" />
|
||||
<PatchedNuSpecFile ParameterType="System.String" Required="true" />
|
||||
<References ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Code Type="Fragment" Language="cs"><![CDATA[
|
||||
var content = System.IO.File.ReadAllText(NuSpecFile);
|
||||
|
||||
var end = content.IndexOf("</metadata>");
|
||||
var newContent = content.Substring(0, end);
|
||||
newContent += "<frameworkAssemblies>\n";
|
||||
foreach (var r in References)
|
||||
{
|
||||
var targetFrameworksStr = r.GetMetadata("NuSpecFrameworkAssembly");
|
||||
foreach (var targetFramework in (targetFrameworksStr ?? "").Split(new char[] {',', ' ', ';'}, System.StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
newContent += " <frameworkAssembly assemblyName=\"" + r.ItemSpec + "\" targetFramework=\"" + targetFramework + "\" />\n";
|
||||
}
|
||||
}
|
||||
newContent += " </frameworkAssemblies>\n ";
|
||||
newContent += content.Substring(end);
|
||||
|
||||
File.WriteAllText(PatchedNuSpecFile, newContent);
|
||||
]]></Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
<Target Name="PackWithFrameworkAssemblies" DependsOnTargets="_CleanNuSpec;_ExtractReferences;Pack" Condition="'$(IsPackable)' == 'true'">
|
||||
<Message Text="Repackaging -> '$(MSBuildProjectName)' from '$(_NuSpecPatched)'" Importance="high" Condition=" '@(_Reference)' != '' " />
|
||||
<AddFrameworkAssemblies NuSpecFile="$(_NuSpec)" PatchedNuSpecFile="$(_NuSpecPatched)" References="@(_Reference)" Condition=" '@(_Reference)' != '' " />
|
||||
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Pack" Properties="NuspecFile=$(_NuSpecPatched)" Condition=" '@(_Reference)' != '' " />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -1,5 +1,6 @@
|
||||
param(
|
||||
[parameter(Position=0)][string] $PreReleaseSuffix = ''
|
||||
[parameter(Position=0)][string] $PreReleaseSuffix = '',
|
||||
[switch] $SkipTests = $false
|
||||
)
|
||||
|
||||
$packageOutputFolder = "$PSScriptRoot\.nupkgs"
|
||||
@@ -14,29 +15,22 @@ if ($LASTEXITCODE -ne 0)
|
||||
|
||||
# Build all
|
||||
Write-Host "Building..." -ForegroundColor "Green"
|
||||
Get-ChildItem "Dapper*.csproj" -Recurse |
|
||||
ForEach-Object {
|
||||
if ($PreReleaseSuffix) {
|
||||
& dotnet build "$_" --version-suffix "$PreReleaseSuffix"
|
||||
} else {
|
||||
& dotnet build "$_"
|
||||
}
|
||||
}
|
||||
msbuild "$PSScriptRoot\Dapper.sln" /m /v:m /nologo /t:Build /p:Configuration=Debug "/p:PackageVersionSuffix=$PreReleaseSuffix"
|
||||
|
||||
# Run tests
|
||||
Write-Host "Running Tests..." -ForegroundColor "Green"
|
||||
Get-ChildItem "Dapper.Test*.csproj" -Recurse |
|
||||
ForEach-Object {
|
||||
& dotnet test "$_"
|
||||
if ($SkipTests)
|
||||
{
|
||||
Write-Host "Skipping Tests..." -ForegroundColor "Yellow"
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Running Tests..." -ForegroundColor "Green"
|
||||
Get-ChildItem "Dapper.Test*.csproj" -Recurse |
|
||||
ForEach-Object {
|
||||
& dotnet test "$_"
|
||||
}
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
}
|
||||
msbuild "$PSScriptRoot\Dapper.sln" /m /v:m /nologo "/t:Build;PackWithFrameworkAssemblies" /p:Configuration=Release "/p:PackageOutputPath=$packageOutputFolder" "/p:PackageVersionSuffix=$PreReleaseSuffix"
|
||||
Reference in New Issue
Block a user