Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 0f8fa8f

Browse files
committed
Migrate to PackageReference to improve build, cleanup and fix build
1 parent 7838a0a commit 0f8fa8f

23 files changed

Lines changed: 110 additions & 371 deletions

build.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<RunCodeAnalysis Condition=" '$(RunCodeAnalysis)' == ''">false</RunCodeAnalysis>
1717
<IntermediateOutputPath>.nuget\</IntermediateOutputPath>
1818
<PackagesPath>$(IntermediateOutputPath)packages</PackagesPath>
19-
<CommonBuildProperties>WarningLevel=0;NoWarn=1591;Out=$(Out);Configuration=$(Configuration);RunCodeAnalysis=$(RunCodeAnalysis);PackageOutputPath=$(Out)</CommonBuildProperties>
19+
<CommonBuildProperties>WarningLevel=0;NoWarn=1591;Out=$(Out);Configuration=$(Configuration);RunCodeAnalysis=$(RunCodeAnalysis);PackageOutputPath=$(Out);NuGetBuildTasksPackTargets=NO-SDK-PACK</CommonBuildProperties>
2020
<DefaultImportance Condition=" '$(DefaultImportance)' == '' ">high</DefaultImportance>
2121
<PS>%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe</PS>
2222
</PropertyGroup>
@@ -75,12 +75,12 @@
7575

7676
<Target Name="Restore">
7777
<ItemGroup>
78-
<NuGetRestore Include="external\ApiIntersect\ApiIntersect.sln" />
7978
<NuGetRestore Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_non_nugetized_reference\b.sln" />
8079
<NuGetRestore Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_multi_platform_solution\forms.sln" />
8180
<NuGetRestore Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_json_dependencies\project.json" />
8281
<MSBuildRestore Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_packaging_project_with_netstandard\a.nuproj" />
8382

83+
<MSBuildRestore Include="external\ApiIntersect\ApiIntersect.sln" />
8484
<MSBuildRestore Include="src\Build\NuGet.Build.Packaging.sln" />
8585
<MSBuildRestore Include="src\VisualStudio\NuGet.Packaging.VisualStudio.sln" />
8686
</ItemGroup>

src/Build/NuGet.Build.Packaging.Tasks.Shared.targets

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@
1111
<PackageProjectUrl>https://github.com/NuGet/NuGet.Build.Packaging</PackageProjectUrl>
1212
</PropertyGroup>
1313

14+
<PropertyGroup>
15+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
16+
<NuGetPackagingTargetsImported>true</NuGetPackagingTargetsImported>
17+
</PropertyGroup>
18+
1419
<Import Project="PackageVersion.targets" Condition="$(PackageVersionImported) != 'true'" />
1520
</Project>

src/Build/NuGet.Build.Packaging.Tasks/MSBuild/Imports/Microsoft.Common.Props/ImportBefore/Microsoft.NuGet.Packaging.ImportBefore.props

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Build/NuGet.Build.Packaging.Tasks/MSBuild/Microsoft.Common.Targets/ImportAfter/Microsoft.NuGet.Packaging.ImportAfter.targets

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 15 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" DefaultTargets="Build">
42
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), NuGet.Build.Packaging.Shared.props))\NuGet.Build.Packaging.Shared.props" />
53
<PropertyGroup>
64
<ProjectGuid>{A3D231D7-31E4-4A70-8CD1-7246C7D069F6}</ProjectGuid>
7-
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
5+
<TargetFramework>net46</TargetFramework>
6+
<NuGetBuildTasksPackTargets>NO-SDK-PACK</NuGetBuildTasksPackTargets>
87
</PropertyGroup>
9-
<ItemGroup>
10-
<Reference Include="System" />
11-
<Reference Include="System.Core" />
12-
</ItemGroup>
138
<ItemGroup>
149
<PackageReference Include="GitInfo" Version="1.1.61" PrivateAssets="all" />
1510
<PackageReference Include="ILRepack" Version="2.0.13" PrivateAssets="all" />
16-
<PackageReference Include="netfx-System.StringResources" Version="3.0.14" PrivateAssets="all" />
11+
<PackageReference Include="netfx-System.StringResources" Version="3.1.5" PrivateAssets="all" />
1712
<PackageReference Include="Microsoft.Build" Version="14.3.0" PrivateAssets="all" />
1813
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3.0" PrivateAssets="all" />
1914
<PackageReference Include="MSBuilder.ThisAssembly.Project" Version="0.3.3" PrivateAssets="all" />
@@ -23,55 +18,29 @@
2318
<PackageReference Include="NuGet.ProjectManagement" Version="4.0.0" PrivateAssets="all" />
2419
</ItemGroup>
2520
<ItemGroup>
26-
<Content Include="NuGet.Build.Packaging.props" />
27-
<Content Include="NuGet.Build.Packaging.targets" />
28-
<Content Include="NuGet.Build.Packaging.CrossTargeting.targets" />
29-
<Content Include="MSBuild\Imports\Microsoft.Common.Props\ImportBefore\Microsoft.NuGet.Packaging.ImportBefore.props" />
30-
<Content Include="MSBuild\Microsoft.Common.Targets\ImportAfter\Microsoft.NuGet.Packaging.ImportAfter.targets" />
31-
<Content Include="NuGet.Build.Packaging.Authoring.targets" />
32-
<Content Include="NuGet.Build.Packaging.Compatibility.props" />
33-
<Content Include="NuGet.Build.Packaging.ReferenceAssembly.targets" />
34-
<Content Include="NuGet.Build.Packaging.Legacy.targets" />
35-
<Content Include="NuGet.Build.Packaging.Inference.targets" />
36-
<Content Include="NuGet.Build.Packaging.Authoring.props" />
37-
<Content Include="GenerateReferenceAssembly.csproj" />
38-
<Content Include="NuGet.Build.Packaging.Legacy.props" />
39-
<Content Include="NuGet.Build.Packaging.Version.props" />
21+
<None Remove="**\*.props;**\*.targets" />
4022
<None Include="NuGet.Build.Packaging.Tasks.targets" />
23+
<Content Include="**\*.props;**\*.targets" Exclude="obj\**\*.*;bin\**\*.*;NuGet.Build.Packaging.Tasks.targets">
24+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
25+
</Content>
26+
</ItemGroup>
27+
<ItemGroup>
28+
<EmbeddedResource Update="Properties\Resources.resx">
29+
<Generator>PublicResXFileCodeGenerator</Generator>
30+
</EmbeddedResource>
4131
</ItemGroup>
4232
<ItemGroup>
4333
<ProjectReference Include="..\..\..\external\ApiIntersect\ApiIntersect\ApiIntersect.csproj">
34+
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
35+
<AdditionalProperties>PrimaryOutputKind=build</AdditionalProperties>
4436
<Project>{cd767d93-6c99-4d6a-a303-3c139a73400e}</Project>
4537
<Name>ApiIntersect</Name>
46-
<IncludeInPackage>false</IncludeInPackage>
4738
</ProjectReference>
4839
</ItemGroup>
49-
<ItemGroup>
50-
<EmbeddedResource Include="Properties\Resources.resx">
51-
<Generator>PublicResXFileCodeGenerator</Generator>
52-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
53-
</EmbeddedResource>
54-
</ItemGroup>
5540
<ItemGroup>
5641
<Compile Include="..\..\GlobalAssemblyInfo.cs">
5742
<Link>GlobalAssemblyInfo.cs</Link>
5843
</Compile>
59-
<Compile Include="ApiIntersect.cs" />
60-
<Compile Include="AssignPackagePath.cs" />
61-
<Compile Include="CreatePackage.cs" />
62-
<Compile Include="Extensions.cs" />
63-
<Compile Include="GenerateAssemblyInfo.cs" />
64-
<Compile Include="GetApiIntersectTargetPaths.cs" />
65-
<Compile Include="MetadataName.cs" />
66-
<Compile Include="Program.cs" />
67-
<Compile Include="Properties\Resources.Designer.cs">
68-
<AutoGen>True</AutoGen>
69-
<DesignTime>True</DesignTime>
70-
<DependentUpon>Resources.resx</DependentUpon>
71-
</Compile>
72-
<Compile Include="ReadLegacyConfigDependencies.cs" />
73-
<Compile Include="ReadLegacyJsonDependencies.cs" />
7444
</ItemGroup>
75-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
7645
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), NuGet.Build.Packaging.Tasks.Shared.targets))\NuGet.Build.Packaging.Tasks.Shared.targets" />
7746
</Project>

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Tasks.targets

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
</ItemDefinitionGroup>
1313

1414
<PropertyGroup>
15+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
16+
1517
<PackageId>NuGet.Build.Packaging</PackageId>
1618
<Title>NuGetizer-3000</Title>
17-
<Description>NuGet Packaging Targets</Description>
19+
<Description>NuGetizer-3000</Description>
1820
<IsDevelopmentDependency>true</IsDevelopmentDependency>
1921
<PrimaryOutputKind>build</PrimaryOutputKind>
2022

@@ -27,12 +29,6 @@
2729

2830
<Target Name="AddBuiltOutput" BeforeTargets="GetPackageContents" DependsOnTargets="AllProjectOutputGroups" Returns="@(PackageFile)">
2931
<ItemGroup>
30-
<PackageFile Include="$(OutputPath)ApiIntersect.exe">
31-
<PackagePath>build\ApiIntersect.exe</PackagePath>
32-
</PackageFile>
33-
<PackageFile Include="$(OutputPath)ApiIntersect.exe.config">
34-
<PackagePath>build\ApiIntersect.exe.config</PackagePath>
35-
</PackageFile>
3632
<PackageFile Include="$(OutputPath)ICSharpCode.Decompiler.dll">
3733
<PackagePath>build\ICSharpCode.Decompiler.dll</PackagePath>
3834
</PackageFile>

0 commit comments

Comments
 (0)