Skip to content

Commit 72d9cfd

Browse files
baronfelKrzysztof-Cieslak
authored andcommitted
fix netcoreapp3.0 aspnet reference and packaging
1 parent 5dcd98c commit 72d9cfd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2891
-2442
lines changed

.config/dotnet-tools.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"fake-cli": {
6+
"version": "5.19.0",
7+
"commands": [
8+
"fake"
9+
]
10+
},
11+
"paket": {
12+
"version": "5.241.6",
13+
"commands": [
14+
"paket"
15+
]
16+
}
17+
}
18+
}

.paket/Paket.Restore.targets

Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
88

99
<DetectedMSBuildVersion>$(MSBuildVersion)</DetectedMSBuildVersion>
10-
<DetectedMSBuildVersion Condition="$(MSBuildVersion) == ''">15.0.0</DetectedMSBuildVersion>
10+
<DetectedMSBuildVersion Condition="'$(MSBuildVersion)' == ''">15.0.0</DetectedMSBuildVersion>
1111
<MSBuildSupportsHashing>false</MSBuildSupportsHashing>
1212
<MSBuildSupportsHashing Condition=" '$(DetectedMSBuildVersion)' &gt; '15.8.0' ">true</MSBuildSupportsHashing>
1313
<!-- Mark that this target file has been loaded. -->
@@ -20,59 +20,86 @@
2020
<PaketBootstrapperStyle Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">proj</PaketBootstrapperStyle>
2121
<PaketExeImage>assembly</PaketExeImage>
2222
<PaketExeImage Condition=" '$(PaketBootstrapperStyle)' == 'proj' ">native</PaketExeImage>
23-
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
23+
<MonoPath Condition="'$(MonoPath)' == '' AND Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
2424
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
2525

2626
<!-- PaketBootStrapper -->
2727
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2828
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2929
<PaketBootStrapperExeDir Condition=" Exists('$(PaketBootStrapperExePath)') " >$([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\</PaketBootStrapperExeDir>
30+
31+
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT' ">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
32+
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
33+
34+
<!-- Disable Paket restore under NCrunch build -->
35+
<PaketRestoreDisabled Condition="'$(NCrunch)' == '1'">True</PaketRestoreDisabled>
3036

31-
<!-- Paket -->
37+
<!-- Disable test for CLI tool completely - overrideable via properties in projects or via environment variables -->
38+
<PaketDisableCliTest Condition=" '$(PaketDisableCliTest)' == '' ">False</PaketDisableCliTest>
3239

33-
<!-- windows, root => tool => proj style => bootstrapper => global -->
34-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
35-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
36-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket.exe</PaketExePath>
37-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(_PaketBootStrapperExeDir)paket.exe</PaketExePath>
38-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' ">paket.exe</PaketExePath>
40+
<PaketIntermediateOutputPath Condition=" '$(PaketIntermediateOutputPath)' == '' ">$(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/'))</PaketIntermediateOutputPath>
41+
</PropertyGroup>
3942

40-
<!-- no windows, try native paket as default, root => tool => proj style => mono paket => bootstrpper => global -->
41-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
42-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
43-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
43+
<!-- Resolve how paket should be called -->
44+
<!-- Current priority is: local (1: repo root, 2: .paket folder) => 3: as CLI tool => as bootstrapper (4: proj Bootstrapper style, 5: BootstrapperExeDir) => 6: global path variable -->
45+
<Target Name="SetPaketCommand" >
46+
<!-- Test if paket is available in the standard locations. If so, that takes priority. Case 1/2 - non-windows specific -->
47+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
48+
<!-- no windows, try native paket as default, root => tool -->
49+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
50+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
51+
</PropertyGroup>
4452

45-
<!-- no windows, try mono paket -->
46-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
47-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
53+
<!-- Test if paket is available in the standard locations. If so, that takes priority. Case 2/2 - same across platforms -->
54+
<PropertyGroup>
55+
<!-- root => tool -->
56+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
57+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
58+
</PropertyGroup>
4859

49-
<!-- no windows, try bootstrapper -->
50-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket.exe</PaketExePath>
60+
<!-- If paket hasn't be found in standard locations, test for CLI tool usage. -->
61+
<!-- First test: Is CLI configured to be used in "dotnet-tools.json"? - can result in a false negative; only a positive outcome is reliable. -->
62+
<PropertyGroup Condition=" '$(PaketExePath)' == '' ">
63+
<_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json"))</_DotnetToolsJson>
64+
<_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"'))</_ConfigContainsPaket>
65+
<_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false</_ConfigContainsPaket>
66+
</PropertyGroup>
5167

52-
<!-- no windows, try global native paket -->
53-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' ">paket</PaketExePath>
68+
<!-- Second test: Call 'dotnet paket' and see if it returns without an error. Mute all the output. Only run if previous test failed and the test has not been disabled. -->
69+
<!-- WARNING: This method can lead to processes hanging forever, and should be used as little as possible. See https://github.com/fsprojects/Paket/issues/3705 for details. -->
70+
<Exec Condition=" '$(PaketExePath)' == '' AND !$(PaketDisableCliTest) AND !$(_ConfigContainsPaket)" Command="dotnet paket --version" IgnoreExitCode="true" StandardOutputImportance="low" StandardErrorImportance="low" >
71+
<Output TaskParameter="ExitCode" PropertyName="LocalPaketToolExitCode" />
72+
</Exec>
5473

55-
<!-- Paket command -->
56-
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
57-
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</PaketCommand>
58-
<PaketCommand Condition=" '$(PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
59-
<PaketCommand Condition=" '$(PaketCommand)' == '' ">"$(PaketExePath)"</PaketCommand>
74+
<!-- If paket is installed as CLI use that. Again, only if paket haven't already been found in standard locations. -->
75+
<PropertyGroup Condition=" '$(PaketExePath)' == '' AND ($(_ConfigContainsPaket) OR '$(LocalPaketToolExitCode)' == '0') ">
76+
<_PaketCommand>dotnet paket</_PaketCommand>
77+
</PropertyGroup>
6078

79+
<!-- If neither local files nor CLI tool can be found, final attempt is searching for boostrapper config before falling back to global path variable. -->
80+
<PropertyGroup Condition=" '$(PaketExePath)' == '' AND '$(_PaketCommand)' == '' ">
81+
<!-- Test for bootstrapper setup -->
82+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
83+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket</PaketExePath>
6184

62-
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
63-
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
85+
<!-- If all else fails, use global path approach. -->
86+
<PaketExePath Condition=" '$(PaketExePath)' == ''">paket</PaketExePath>
87+
</PropertyGroup>
6488

65-
<!-- Disable automagic references for F# dotnet sdk -->
66-
<!-- This will not do anything for other project types -->
67-
<!-- see https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1032-fsharp-in-dotnet-sdk.md -->
68-
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
69-
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
89+
<!-- If not using CLI, setup correct execution command. -->
90+
<PropertyGroup Condition=" '$(_PaketCommand)' == '' ">
91+
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
92+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</_PaketCommand>
93+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</_PaketCommand>
94+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)"</_PaketCommand>
95+
</PropertyGroup>
7096

71-
<!-- Disable Paket restore under NCrunch build -->
72-
<PaketRestoreDisabled Condition="'$(NCrunch)' == '1'">True</PaketRestoreDisabled>
97+
<!-- The way to get a property to be available outside the target is to use this task. -->
98+
<CreateProperty Value="$(_PaketCommand)">
99+
<Output TaskParameter="Value" PropertyName="PaketCommand"/>
100+
</CreateProperty>
73101

74-
<PaketIntermediateOutputPath Condition=" '$(PaketIntermediateOutputPath)' == '' ">$(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/'))</PaketIntermediateOutputPath>
75-
</PropertyGroup>
102+
</Target>
76103

77104
<Target Name="PaketBootstrapping" Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">
78105
<MSBuild Projects="$(PaketToolsPath)paket.bootstrapper.proj" Targets="Restore" />
@@ -81,7 +108,7 @@
81108
<!-- Official workaround for https://docs.microsoft.com/en-us/visualstudio/msbuild/getfilehash-task?view=vs-2019 -->
82109
<UsingTask TaskName="Microsoft.Build.Tasks.GetFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(MSBuildSupportsHashing)' == 'true' And '$(DetectedMSBuildVersion)' &lt; '16.0.360' " />
83110
<UsingTask TaskName="Microsoft.Build.Tasks.VerifyFileHash" AssemblyName="Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Condition=" '$(MSBuildSupportsHashing)' == 'true' And '$(DetectedMSBuildVersion)' &lt; '16.0.360' " />
84-
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" DependsOnTargets="PaketBootstrapping">
111+
<Target Name="PaketRestore" Condition="'$(PaketRestoreDisabled)' != 'True'" BeforeTargets="_GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" DependsOnTargets="SetPaketCommand;PaketBootstrapping">
85112

86113
<!-- Step 1 Check if lockfile is properly restored (if the hash of the lockfile and the cache-file match) -->
87114
<PropertyGroup>
@@ -203,7 +230,7 @@
203230
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
204231
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
205232
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
206-
<CopyLocal Condition="'$(Splits)' == '6'">$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
233+
<CopyLocal Condition="'%(PaketReferencesFileLinesInfo.Splits)' == '6'">$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5])</CopyLocal>
207234
</PaketReferencesFileLinesInfo>
208235
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
209236
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
@@ -246,7 +273,7 @@
246273
</PropertyGroup>
247274
</Target>
248275

249-
<Target Name="PaketOverrideNuspec" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(PaketIntermediateOutputPath)/$(MSBuildProjectFile).references')" >
276+
<Target Name="PaketOverrideNuspec" DependsOnTargets="SetPaketCommand" AfterTargets="GenerateNuspec" Condition="('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(PaketIntermediateOutputPath)/$(MSBuildProjectFile).references')" >
250277
<ItemGroup>
251278
<_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/>
252279
<MSBuildMajorVersion Include="$(DetectedMSBuildVersion.Replace(`-`, `.`).Split(`.`)[0])" />
@@ -300,7 +327,7 @@
300327
DevelopmentDependency="$(DevelopmentDependency)"
301328
BuildOutputInPackage="@(_BuildOutputInPackage)"
302329
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
303-
SymbolPackageFormat="symbols.nupkg"
330+
SymbolPackageFormat="$(SymbolPackageFormat)"
304331
TargetFrameworks="@(_TargetFrameworks)"
305332
AssemblyName="$(AssemblyName)"
306333
PackageOutputPath="$(PackageOutputAbsolutePath)"
@@ -347,7 +374,7 @@
347374
DevelopmentDependency="$(DevelopmentDependency)"
348375
BuildOutputInPackage="@(_BuildOutputInPackage)"
349376
TargetPathsToSymbols="@(_TargetPathsToSymbols)"
350-
SymbolPackageFormat="symbols.nupkg"
377+
SymbolPackageFormat="$(SymbolPackageFormat)"
351378
TargetFrameworks="@(_TargetFrameworks)"
352379
AssemblyName="$(AssemblyName)"
353380
PackageOutputPath="$(PackageOutputAbsolutePath)"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Saturn has nice [documentation](https://saturnframework.github.io/docs/) and I a
1414

1515
## How to build
1616

17-
1. Install the .NET Core 3.0 preview 7 SDK from https://dotnet.microsoft.com/download/dotnet-core/3.0
18-
2. Install FAKE: `dotnet tool install fake-cli -g`
19-
3. Inside the repo directory, run `fake build`
17+
1. Install the .NET Core 3.1 SDK from https://dotnet.microsoft.com/download/dotnet-core/3.1
18+
2. Restore dotnet SDK tools: `dotnet tool restore`
19+
3. Inside the repo directory, run `dotnet fake build`
2020

2121
## How to contribute
2222

azure-pipelines.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,11 @@ jobs:
88
displayName: 'Install .net core 3.0'
99
inputs:
1010
version: '3.0.100'
11-
- script: dotnet tool install fake-cli --tool-path .
11+
- script: dotnet tool restore
1212
displayName: Install FAKE
13-
- script: fake build
13+
- script: dotnet fake build
1414
displayName: Run Build
1515
- task: PublishBuildArtifacts@1
1616
inputs:
1717
pathtoPublish: build
1818
artifactName: Saturn
19-
# - job: Linux
20-
# pool:
21-
# vmImage: 'ubuntu-16.04'
22-
# steps:
23-
# - task: DotNetCoreInstaller@0
24-
# displayName: 'Install .net core 3.0 (preview)'
25-
# inputs:
26-
# version: '3.0.100-preview7-012821'
27-
# - script: dotnet tool install fake-cli --tool-path .
28-
# displayName: Install FAKE
29-
# - script: ./fake build
30-
# displayName: Run Build
31-
# - task: PublishBuildArtifacts@1
32-
# inputs:
33-
# pathtoPublish: build
34-
# artifactName: Saturn

build.fsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,13 @@ Target.create "Test" (fun _ ->
112112
// --------------------------------------------------------------------------------------
113113

114114
Target.create "Pack" (fun _ ->
115-
Paket.pack (fun p ->
115+
DotNet.pack (fun p ->
116116
{ p with
117-
BuildConfig = "Release";
118-
OutputPath = buildDir;
119-
Version = release.NugetVersion
120-
ReleaseNotes = String.concat "\n" release.Notes
121-
MinimumFromLockFile = false
117+
Configuration = DotNet.BuildConfiguration.Release
118+
OutputPath = Some buildDir
119+
MSBuildParams = { p.MSBuildParams with Properties = [("Version", release.NugetVersion); ("ReleaseNotes", String.concat "\n" release.Notes)]}
122120
}
123-
)
121+
) "Saturn.sln"
124122
)
125123

126124
Target.create "ReleaseGitHub" (fun _ ->
@@ -189,4 +187,4 @@ Target.create "Release" DoNothing
189187
==> "Push"
190188
==> "Release"
191189

192-
Target.runOrDefault "Pack"
190+
Target.runOrDefault "Pack"

0 commit comments

Comments
 (0)