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

Commit 1627eba

Browse files
authored
Merge pull request #120 from kzu/netstandard
Add NETStandard/NETCore support
2 parents 4d2f073 + 37b4e90 commit 1627eba

26 files changed

Lines changed: 356 additions & 103 deletions

.editorconfig

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,76 @@ end_of_line = CRLF
1010

1111
[*.{cs,fs}]
1212
indent_style = tab
13-
indent_size = 4
1413

1514
[*.{sln,proj,props,targets,xaml,config,nuspec,vsixmanifest,vsct,vstemplate}]
1615
indent_style = tab
17-
indent_size = 4
1816

19-
[*.{csproj,ps1,resx,rst,fsproj}]
17+
[*.{csproj,ps1,resx,rst,fsproj,wxs,wxi}]
2018
indent_style = space
2119
indent_size = 2
20+
21+
[*.{tt}]
22+
indent_style = space
23+
indent_size = 4
24+
25+
# CSharp code style settings:
26+
[*.cs]
27+
# Prefer "var" everywhere
28+
csharp_style_var_for_built_in_types = true:suggestion
29+
csharp_style_var_when_type_is_apparent = true:suggestion
30+
csharp_style_var_elsewhere = true:suggestion
31+
32+
# Prefer method-like constructs to have a block body
33+
csharp_style_expression_bodied_methods = false:none
34+
csharp_style_expression_bodied_constructors = false:none
35+
csharp_style_expression_bodied_operators = false:none
36+
37+
# Prefer property-like constructs to have a block body
38+
csharp_style_expression_bodied_properties = false:none
39+
csharp_style_expression_bodied_indexers = false:none
40+
csharp_style_expression_bodied_accessors = false:none
41+
42+
# Don't suggest more modern language features when available
43+
csharp_style_pattern_matching_over_is_with_cast_check = false:suggestion
44+
csharp_style_pattern_matching_over_as_with_null_check = false:suggestion
45+
csharp_style_inlined_variable_declaration = false:suggestion
46+
csharp_style_throw_expression = false:suggestion
47+
csharp_style_conditional_delegate_call = false:suggestion
48+
49+
# Newline settings
50+
csharp_new_line_before_open_brace = all
51+
csharp_new_line_before_else = true
52+
csharp_new_line_before_catch = true
53+
csharp_new_line_before_finally = true
54+
csharp_new_line_before_members_in_object_initializers = true
55+
csharp_new_line_before_members_in_anonymous_types = true
56+
57+
# Indentation preferences
58+
csharp_indent_block_contents = true
59+
csharp_indent_braces = false
60+
csharp_indent_case_contents = true
61+
csharp_indent_switch_labels = true
62+
csharp_indent_labels = flush_left
63+
64+
# Space preferences
65+
csharp_space_after_cast = false
66+
csharp_space_after_colon_in_inheritance_clause = true
67+
csharp_space_after_comma = true
68+
csharp_space_after_dot = false
69+
csharp_space_after_keywords_in_control_flow_statements = true
70+
csharp_space_after_semicolon_in_for_statement = true
71+
csharp_space_around_binary_operators = before_and_after
72+
csharp_space_around_declaration_statements = do_not_ignore
73+
csharp_space_before_colon_in_inheritance_clause = true
74+
csharp_space_before_comma = false
75+
csharp_space_before_dot = false
76+
csharp_space_before_open_square_brackets = false
77+
csharp_space_before_semicolon_in_for_statement = false
78+
csharp_space_between_empty_square_brackets = false
79+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
80+
csharp_space_between_method_call_name_and_opening_parenthesis = false
81+
csharp_space_between_method_call_parameter_list_parentheses = false
82+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
83+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
84+
csharp_space_between_method_declaration_parameter_list_parentheses = false
85+
csharp_space_between_square_brackets = false

appveyor.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,16 @@ init:
1111
}
1212
1313
build_script:
14-
- cmd: taskkill /f /im MSBuild.exe /fi "memusage gt 40" 2>NUL
14+
- cmd: echo /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" >> msbuild.rsp
1515
- cmd: build.cmd /restore
1616
- cmd: build.cmd /release
17-
- cmd: taskkill /f /im MSBuild.exe /fi "memusage gt 40" 2>NUL
1817

1918
install:
2019
- cmd: git submodule update --init --recursive
2120

2221
# we run the tests ourselves in build.proj for coverage
2322
test: off
2423

25-
# build cache to preserve files/folders between builds
26-
cache:
27-
- '%LocalAppData%\NuGet\Cache'
28-
- '%USERPROFILE%\.nuget\packages'
29-
3024
deploy:
3125
- provider: NuGet
3226
api_key:

build.cmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set BuildConfiguration=Debug
77
set MSBuildTarget=All
88
set NodeReuse=true
99
set MultiProcessor=/m
10+
set MSBuildAdditionalArguments=/m
1011

1112
:ParseArguments
1213
if "%1" == "" goto :DoneParsing
@@ -20,7 +21,7 @@ if /I "%1" == "/test" set MSBuildTarget=Test&&shift&& goto :ParseArguments
2021
if /I "%1" == "/restore" set MSBuildTarget=Restore&&shift&& goto :ParseArguments
2122
if /I "%1" == "/no-node-reuse" set NodeReuse=false&&shift&& goto :ParseArguments
2223
if /I "%1" == "/no-multi-proc" set MultiProcessor=&&shift&& goto :ParseArguments
23-
MSBuildAdditionalArguments="%1 %MSBuildAdditionalArguments"%&&shift&& goto :ParseArguments
24+
set MSBuildAdditionalArguments=%1 %MSBuildAdditionalArguments%&&shift&& goto :ParseArguments
2425
:DoneParsing
2526

2627
:: Detect if MSBuild is in the path

build.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<NuGetRestore Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_non_nugetized_reference\b.sln" />
8181
<NuGetRestore Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_multi_platform_solution\forms.sln" />
8282
<NuGetRestore Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_library_with_json_dependencies\project.json" />
83+
<MSBuildRestore Include="src\Build\NuGet.Build.Packaging.Tests\Scenarios\given_a_packaging_project_with_netstandard\a.nuproj" />
8384

8485
<MSBuildRestore Include="src\Build\NuGet.Build.Packaging.sln" />
8586
<MSBuildRestore Include="src\VisualStudio\NuGet.Packaging.VisualStudio.sln" />

packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="GitInfo" version="1.1.29" />
4-
<package id="xunit.runner.console" version="2.1.0" />
5-
<package id="xunit.runner.msbuild" version="2.1.0" />
4+
<package id="xunit.runner.console" version="2.2.0" />
5+
<package id="xunit.runner.msbuild" version="2.2.0" />
66
<package id="OpenCover" version="4.6.519" targetFramework="net45" />
77
<package id="ReportGenerator" version="2.4.5" targetFramework="net45" />
88
</packages>

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Authoring.props

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ Copyright (c) .NET Foundation. All rights reserved.
1111
-->
1212
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1313
<PropertyGroup>
14-
<TargetFrameworkMoniker>NuGet,Version=v1.0</TargetFrameworkMoniker>
14+
<!--<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
15+
<TargetFramework>netstandard1.0</TargetFramework>
16+
<TargetFrameworkMoniker>.NETStandard,Version=1.0</TargetFrameworkMoniker>
17+
<NuGetTargetMoniker>$(TargetFrameworkMoniker)</NuGetTargetMoniker>
18+
<PackageTargetFallback>net11;net20;net35;net40;net403;net45;net451;net452;net46;net461;net462;netcore;netcore45;netcore451;netcore50;win8;win81;win10;sl4;sl5;wp;wp7;wp75;wp8;wp81;wpa81;uap;uap10;netstandard1.0;netstandard1.1;netstandard1.2;netstandard1.3;netstandard1.4;netstandard1.5;netstandard1.6;netstandard2.0;netcoreapp1.0;netcoreapp2.0;monoandroid;monotouch;monomac;xamarinios;xamarinmac;xamarinpsthree;xamarinpsfour;xamarinpsvita;xamarinwatchos;xamarintvos;xamarinxboxthreesixty;xamarinxboxone</PackageTargetFallback>-->
19+
1520
<TargetExt>.nupkg</TargetExt>
1621

1722
<!-- The Pack target generates to the output path directly -->

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ Copyright (c) .NET Foundation. All rights reserved.
1919
<ResolveAssemblyReferencesDependsOn />
2020
</PropertyGroup>
2121

22+
<ItemDefinitionGroup>
23+
<!-- This turns off _GetProjectReferenceTargetFrameworkProperties which passes down
24+
our TF to referenced projects and causes build to fail even if we don't really
25+
need to match up with referenced projects outputs. We're basically using the
26+
documented escape hatch, see
27+
https://github.com/Microsoft/msbuild/blob/2634f05a660b14c64ae4e924d900dd200d5032e7/src/Tasks/Microsoft.Common.CurrentVersion.targets#L1537
28+
-->
29+
<_MSBuildProjectReferenceExistent>
30+
<SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
31+
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
32+
<AdditionalProperties>FromPackagingProject=true</AdditionalProperties>
33+
</_MSBuildProjectReferenceExistent>
34+
</ItemDefinitionGroup>
35+
2236
<!-- Just to make it easy for consumers to request the TargetPath as usual but get the
2337
actual package file, which contains the PackageVersion and will be dynamic therefore. -->
2438
<Target Name="UpdateTargetPath"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<!--
2+
***********************************************************************************************
3+
Microsoft.NuGet.Build.Packaging.CrossTargeting.targets
4+
5+
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6+
created a backup copy. Incorrect changes to this file will make it
7+
impossible to load or build your projects from the command-line or the IDE.
8+
9+
Copyright (c) .NET Foundation. All rights reserved.
10+
***********************************************************************************************
11+
-->
12+
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
13+
14+
<Target Name="GetNativeManifest" />
15+
<Target Name="GetCopyToOutputDirectoryItems" />
16+
17+
<!--
18+
============================================================
19+
GetTargetPathWithTargetPlatformMoniker
20+
NOTE: depends on Microsoft.Common.CrossTargeting.targets
21+
22+
When cross-targeting and the authoring project references a
23+
nugetized library, return all the determined target paths.
24+
============================================================
25+
-->
26+
<Target Name="GetTargetPathWithTargetPlatformMoniker"
27+
DependsOnTargets="_SetGetTargetPathWithTargetPlatformMonikerInnerTarget;DispatchToInnerBuilds"
28+
Returns="@(InnerOutput)">
29+
<ItemGroup>
30+
<InnerOutput>
31+
<IsNuGetized>true</IsNuGetized>
32+
</InnerOutput>
33+
</ItemGroup>
34+
</Target>
35+
36+
<Target Name="_SetGetTargetPathWithTargetPlatformMonikerInnerTarget">
37+
<PropertyGroup>
38+
<InnerTargets>GetTargetPathWithTargetPlatformMoniker</InnerTargets>
39+
</PropertyGroup>
40+
</Target>
41+
42+
<!--
43+
============================================================
44+
GetPackageContents
45+
Cross-targeting version of GetPackageContents.
46+
NOTE: depends on Microsoft.Common.CrossTargeting.targets
47+
48+
[OUT]
49+
@(InnerOutput) - The combined output items of the inner targets across
50+
all builds.
51+
============================================================
52+
-->
53+
<Target Name="GetPackageContents" DependsOnTargets="_SetGetPackageContentsInnerTarget;DispatchToInnerBuilds" Returns="@(InnerOutput)" />
54+
55+
<Target Name="_SetGetPackageContentsInnerTarget">
56+
<PropertyGroup>
57+
<InnerTargets>GetPackageContents</InnerTargets>
58+
</PropertyGroup>
59+
</Target>
60+
61+
</Project>

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.Tasks.csproj

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,29 @@
1313
<Reference Include="System" />
1414
<Reference Include="System.Core" />
1515
</ItemGroup>
16-
<ItemGroup>
16+
<ItemGroup>
17+
<PackageReference Include="Costura.Fody" Version="1.3.3" />
18+
<PackageReference Include="Fody" Version="1.29.4" />
19+
<PackageReference Include="GitInfo" Version="1.*" />
20+
<PackageReference Include="netfx-System.StringResources" Version="*" />
21+
<PackageReference Include="Microsoft.Build" Version="14.3.0" />
22+
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="14.3.0" />
23+
<PackageReference Include="MSBuilder.ThisAssembly.Project" Version="0.3.3" />
24+
<PackageReference Include="Newtonsoft.Json" Version="6.0.8" />
25+
<PackageReference Include="NuGet.Client" Version="4.0.0" />
26+
<PackageReference Include="NuGet.Packaging" Version="4.0.0" />
27+
<PackageReference Include="NuGet.ProjectManagement" Version="4.0.0" />
28+
</ItemGroup>
29+
<ItemGroup>
1730
<Content Include="FodyWeavers.xml" />
1831
<Content Include="NuGet.Build.Packaging.props">
1932
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
20-
<SubType>Designer</SubType>
2133
</Content>
2234
<Content Include="NuGet.Build.Packaging.targets">
2335
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
24-
<SubType>Designer</SubType>
36+
</Content>
37+
<Content Include="NuGet.Build.Packaging.CrossTargeting.targets">
38+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2539
</Content>
2640
<Content Include="MSBuild\Imports\Microsoft.Common.Props\ImportBefore\Microsoft.NuGet.Packaging.ImportBefore.props">
2741
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -31,9 +45,9 @@
3145
</Content>
3246
<Content Include="NuGet.Build.Packaging.Authoring.targets">
3347
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
48+
<SubType>Designer</SubType>
3449
</Content>
3550
<None Include="NuGet.Build.Packaging.Version.props">
36-
<SubType>Designer</SubType>
3751
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3852
</None>
3953
<None Include="NuGet.Build.Packaging.Tasks.targets">

src/Build/NuGet.Build.Packaging.Tasks/NuGet.Build.Packaging.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Copyright (c) .NET Foundation. All rights reserved.
1717
<!-- Disable built-in Pack -->
1818
<NuGetBuildTasksPackTargets>NO-SDK-PACK</NuGetBuildTasksPackTargets>
1919
<ImportNuGetBuildTasksPackTargetsFromSdk>false</ImportNuGetBuildTasksPackTargetsFromSdk>
20+
<!-- Ensure the right value is always available -->
21+
<IsCrossTargetingBuild Condition="'$(IsCrossTargetingBuild)' == '' and '$(TargetFrameworks)' != '' and '$(TargetFramework)' == ''">true</IsCrossTargetingBuild>
2022
</PropertyGroup>
2123

2224
<PropertyGroup>

0 commit comments

Comments
 (0)