2
2
<!-- Prevent dotnet template engine to parse this file -->
3
3
<!-- /-:cnd:noEmit-->
4
4
<PropertyGroup >
5
+ <!-- make MSBuild track this file for incremental builds. -->
6
+ <!-- ref https://blogs.msdn.microsoft.com/msbuild/2005/09/26/how-to-ensure-changes-to-a-custom-target-file-prompt-a-rebuild/ -->
7
+ <MSBuildAllProjects >$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects >
5
8
<!-- Mark that this target file has been loaded. -->
6
9
<IsPaketRestoreTargetsFileLoaded >true</IsPaketRestoreTargetsFileLoaded >
7
10
<PaketToolsPath >$(MSBuildThisFileDirectory)</PaketToolsPath >
27
30
<DisableImplicitSystemValueTupleReference >true</DisableImplicitSystemValueTupleReference >
28
31
</PropertyGroup >
29
32
30
- <Target Name =" PaketRestore" BeforeTargets =" _GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" >
33
+ <Target Name =" PaketRestore" Condition = " '$(PaketRestoreDisabled)' != 'True' " BeforeTargets =" _GenerateDotnetCliToolReferenceSpecs;_GenerateProjectRestoreGraphPerFramework;_GenerateRestoreGraphWalkPerFramework;CollectPackageReferences" >
31
34
32
35
<!-- Step 1 Check if lockfile is properly restored -->
33
36
<PropertyGroup >
34
37
<PaketRestoreRequired >true</PaketRestoreRequired >
38
+ <NoWarn >$(NoWarn);NU1603</NoWarn >
35
39
</PropertyGroup >
36
40
41
+ <!-- Because ReadAllText is slow on osx/linux, try to find shasum and awk -->
42
+ <PropertyGroup >
43
+ <PaketRestoreCachedHasher Condition =" '$(OS)' != 'Windows_NT' And '$(PaketRestoreCachedHasher)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')" >/usr/bin/shasum $(PaketRestoreCacheFile) | /usr/bin/awk '{ print $1 }'</PaketRestoreCachedHasher >
44
+ <PaketRestoreLockFileHasher Condition =" '$(OS)' != 'Windows_NT' And '$(PaketRestoreLockFileHash)' == '' And Exists('/usr/bin/shasum') And Exists('/usr/bin/awk')" >/usr/bin/shasum $(PaketLockFilePath) | /usr/bin/awk '{ print $1 }'</PaketRestoreLockFileHasher >
45
+ </PropertyGroup >
46
+
47
+ <!-- If shasum and awk exist get the hashes -->
48
+ <Exec Condition =" '$(PaketRestoreCachedHasher)' != '' " Command =" $(PaketRestoreCachedHasher)" ConsoleToMSBuild =' true' >
49
+ <Output TaskParameter =" ConsoleOutput" PropertyName =" PaketRestoreCachedHash" />
50
+ </Exec >
51
+ <Exec Condition =" '$(PaketRestoreLockFileHasher)' != '' " Command =" $(PaketRestoreLockFileHasher)" ConsoleToMSBuild =' true' >
52
+ <Output TaskParameter =" ConsoleOutput" PropertyName =" PaketRestoreLockFileHash" />
53
+ </Exec >
54
+
37
55
<PropertyGroup Condition =" Exists('$(PaketRestoreCacheFile)') " >
38
- <PaketRestoreCachedHash >$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash >
39
- <PaketRestoreLockFileHash >$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash >
56
+ <!-- if no hash has been done yet fall back to just reading in the files and comparing them -->
57
+ <PaketRestoreCachedHash Condition =" '$(PaketRestoreCachedHash)' == '' " >$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash >
58
+ <PaketRestoreLockFileHash Condition =" '$(PaketRestoreLockFileHash)' == '' " >$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash >
40
59
<PaketRestoreRequired >true</PaketRestoreRequired >
41
60
<PaketRestoreRequired Condition =" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' " >false</PaketRestoreRequired >
42
61
<PaketRestoreRequired Condition =" '$(PaketRestoreLockFileHash)' == '' " >true</PaketRestoreRequired >
80
99
</PropertyGroup >
81
100
82
101
<!-- Step 3 Restore project specific stuff if required -->
83
- <Warning Condition =" '$(PaketRestoreRequired)' == 'true' " Text =" Detected a change ('$(PaketRestoreRequiredReason)') in the project file '$(MSBuildProjectFullPath)', calling paket restore" />
102
+ <Message Condition =" '$(PaketRestoreRequired)' == 'true' " Importance = " low " Text =" Detected a change ('$(PaketRestoreRequiredReason)') in the project file '$(MSBuildProjectFullPath)', calling paket restore" />
84
103
<Exec Command =' $(PaketCommand) restore --project "$(MSBuildProjectFullPath)"' Condition =" '$(PaketRestoreRequired)' == 'true' " ContinueOnError =" false" />
85
104
86
105
<!-- This shouldn't actually happen, but just to be sure. -->
87
- <Error Condition =" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' " Text =" A paket file for the framework '$(TargetFramework )' is missing. Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." />
106
+ <Error Condition =" !Exists('$(PaketResolvedFilePath)') AND '$(TargetFramework)' != '' AND '$(ResolveNuGetPackages)' != 'False' " Text =" Paket file '$(PaketResolvedFilePath )' is missing while restoring $(MSBuildProjectFile) . Please delete 'paket-files/paket.restore.cached' and call 'paket restore'." />
88
107
89
108
<!-- Step 4 forward all msbuild properties (PackageReference, DotNetCliToolReference) to msbuild -->
90
109
<ReadLinesFromFile Condition =" Exists('$(PaketResolvedFilePath)')" File =" $(PaketResolvedFilePath)" >
95
114
<PaketReferencesFileLinesInfo Include =" @(PaketReferencesFileLines)" >
96
115
<PackageName >$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName >
97
116
<PackageVersion >$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion >
117
+ <AllPrivateAssets >$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets >
98
118
</PaketReferencesFileLinesInfo >
99
119
<PackageReference Include =" %(PaketReferencesFileLinesInfo.PackageName)" >
100
120
<Version >%(PaketReferencesFileLinesInfo.PackageVersion)</Version >
121
+ <PrivateAssets Condition =" %(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'true'" >All</PrivateAssets >
101
122
</PackageReference >
102
123
</ItemGroup >
103
124
132
153
</Target >
133
154
134
155
<Target Name =" PaketOverrideNuspec" AfterTargets =" GenerateNuspec" Condition =" ('$(IsPackable)' == '' Or '$(IsPackable)' == 'true') And Exists('$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).references')" >
156
+ <ItemGroup >
157
+ <_NuspecFilesNewLocation Include =" $(BaseIntermediateOutputPath)$(Configuration)\*.nuspec" />
158
+ </ItemGroup >
159
+
135
160
<PropertyGroup >
136
161
<PaketProjectFile >$(MSBuildProjectDirectory)/$(MSBuildProjectFile)</PaketProjectFile >
137
162
<ContinuePackingAfterGeneratingNuspec >true</ContinuePackingAfterGeneratingNuspec >
138
163
<UseNewPack >false</UseNewPack >
139
164
<UseNewPack Condition =" '$(NuGetToolVersion)' != '4.0.0' " >true</UseNewPack >
165
+ <AdjustedNuspecOutputPath >$(BaseIntermediateOutputPath)$(Configuration)</AdjustedNuspecOutputPath >
166
+ <AdjustedNuspecOutputPath Condition =" @(_NuspecFilesNewLocation) == ''" >$(BaseIntermediateOutputPath)</AdjustedNuspecOutputPath >
140
167
</PropertyGroup >
141
168
142
169
<ItemGroup >
143
- <_NuspecFiles Include =" $(BaseIntermediateOutputPath) *.nuspec" />
170
+ <_NuspecFiles Include =" $(AdjustedNuspecOutputPath)\ *.nuspec" />
144
171
</ItemGroup >
145
172
146
173
<Exec Command =' $(PaketCommand) fix-nuspecs files "@(_NuspecFiles)" project-file "$(PaketProjectFile)" ' Condition =" @(_NuspecFiles) != ''" />
147
174
148
175
<ConvertToAbsolutePath Condition =" @(_NuspecFiles) != ''" Paths =" @(_NuspecFiles)" >
149
176
<Output TaskParameter =" AbsolutePaths" PropertyName =" NuspecFileAbsolutePath" />
150
- </ConvertToAbsolutePath >
177
+ </ConvertToAbsolutePath >
178
+
151
179
152
180
<!-- Call Pack -->
153
181
<PackTask Condition =" $(UseNewPack)"
184
212
Serviceable =" $(Serviceable)"
185
213
FrameworkAssemblyReferences =" @(_FrameworkAssemblyReferences)"
186
214
ContinuePackingAfterGeneratingNuspec =" $(ContinuePackingAfterGeneratingNuspec)"
187
- NuspecOutputPath =" $(BaseIntermediateOutputPath )"
215
+ NuspecOutputPath =" $(AdjustedNuspecOutputPath )"
188
216
IncludeBuildOutput =" $(IncludeBuildOutput)"
189
217
BuildOutputFolder =" $(BuildOutputTargetFolder)"
190
218
ContentTargetFolders =" $(ContentTargetFolders)"
226
254
Serviceable =" $(Serviceable)"
227
255
AssemblyReferences =" @(_References)"
228
256
ContinuePackingAfterGeneratingNuspec =" $(ContinuePackingAfterGeneratingNuspec)"
229
- NuspecOutputPath =" $(BaseIntermediateOutputPath )"
257
+ NuspecOutputPath =" $(AdjustedNuspecOutputPath )"
230
258
IncludeBuildOutput =" $(IncludeBuildOutput)"
231
259
BuildOutputFolder =" $(BuildOutputTargetFolder)"
232
260
ContentTargetFolders =" $(ContentTargetFolders)"
236
264
NuspecProperties =" $(NuspecProperties)" />
237
265
</Target >
238
266
<!-- /+:cnd:noEmit-->
239
- </Project >
267
+ </Project >
0 commit comments