-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFoDeployablePackageService.cs
More file actions
628 lines (524 loc) · 23.9 KB
/
Copy pathFoDeployablePackageService.cs
File metadata and controls
628 lines (524 loc) · 23.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
using System.Diagnostics;
using System.IO.Compression;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
internal static class FoDeployablePackageService
{
private static readonly Regex VersionPattern = new(@"\d+\.\d+\.\d+(?:\.\d+)?", RegexOptions.Compiled);
private static readonly string[] IncludedRootFolders = ["bin", "AdditionalFiles", "Reports", "Resources"];
private const string EmptyFolderPlaceholderFileName = "_nugetutil.keep";
public static bool IsFoModelDirectory(string path)
{
if (!Directory.Exists(path))
{
return false;
}
var xrefPath = Directory.EnumerateFiles(path, "*.xref", SearchOption.TopDirectoryOnly)
.OrderBy(file => file, StringComparer.OrdinalIgnoreCase)
.FirstOrDefault();
if (string.IsNullOrWhiteSpace(xrefPath))
{
return false;
}
var packageId = Path.GetFileNameWithoutExtension(xrefPath);
if (string.IsNullOrWhiteSpace(packageId))
{
return false;
}
var dllPath = Path.Combine(path, "bin", $"Dynamics.AX.{packageId}.dll");
return File.Exists(dllPath);
}
public static IReadOnlyList<string> DiscoverModelDirectories(string parentDirectory, string? filter)
{
if (!Directory.Exists(parentDirectory))
{
return [];
}
return Directory.EnumerateDirectories(parentDirectory, "*", SearchOption.TopDirectoryOnly)
.Where(path => MatchesFilter(Path.GetFileName(path), filter))
.Where(IsFoModelDirectory)
.OrderBy(path => path, StringComparer.OrdinalIgnoreCase)
.ToList();
}
public static async Task<FoDeployablePackResult> BuildAsync(
string packageSourcePath,
string outputFolder,
string workingDirectory,
bool saveNuspecToOutput,
bool isolateExportFolder,
bool whatIf)
{
var tempRoot = Path.Combine(Path.GetTempPath(), "NugetUtil", "fopack", Guid.NewGuid().ToString("N"));
try
{
var extractResult = ExtractPayload(packageSourcePath, tempRoot);
if (!extractResult.Success)
{
return FoDeployablePackResult.Fail(extractResult.Error!);
}
var payload = extractResult.Payload!;
var nuspecPath = Path.Combine(tempRoot, payload.PackageId + ".nuspec");
var nuspecWriteResult = WriteNuspec(nuspecPath, payload.PackageId, payload.Version, payload.XrefFileName, payload.PresentRoots);
if (!nuspecWriteResult.Success)
{
return FoDeployablePackResult.Fail(nuspecWriteResult.Error!);
}
string? exportedNuspecPath = null;
if (saveNuspecToOutput && !whatIf)
{
var exportFolder = isolateExportFolder
? Path.Combine(outputFolder, payload.PackageId)
: outputFolder;
ExportPackInputs(tempRoot, exportFolder, payload);
exportedNuspecPath = Path.Combine(exportFolder, payload.PackageId + ".nuspec");
File.Copy(nuspecPath, exportedNuspecPath, overwrite: true);
}
var packResult = await ProcessRunner.RunAsync(
fileName: "dotnet",
arguments:
[
"pack",
nuspecPath,
"-o",
outputFolder
],
workingDirectory: workingDirectory,
whatIf: whatIf,
sensitiveValues: [],
printOutputOnSuccess: false);
if (!packResult.Success)
{
return FoDeployablePackResult.Fail(packResult.Error!);
}
var nupkgPath = ResolvePackedNupkgPath(outputFolder, payload.PackageId, payload.Version);
if (!whatIf && string.IsNullOrWhiteSpace(nupkgPath))
{
var expectedRaw = Path.Combine(outputFolder, $"{payload.PackageId}.{payload.Version}.nupkg");
var normalizedVersion = NormalizeVersionForNupkgFileName(payload.Version);
var expectedNormalized = Path.Combine(outputFolder, $"{payload.PackageId}.{normalizedVersion}.nupkg");
return FoDeployablePackResult.Fail(
$"Pack succeeded but expected file not found. Checked: {expectedRaw}; {expectedNormalized}");
}
return FoDeployablePackResult.Ok(
payload.PackageId,
payload.Version,
nupkgPath ?? Path.Combine(outputFolder, $"{payload.PackageId}.{payload.Version}.nupkg"),
exportedNuspecPath);
}
catch (Exception ex)
{
return FoDeployablePackResult.Fail($"Failed to pack Dynamics 365 FO package source '{packageSourcePath}': {ex.Message}");
}
finally
{
try
{
if (Directory.Exists(tempRoot))
{
Directory.Delete(tempRoot, recursive: true);
}
}
catch
{
}
}
}
private static FoPayloadExtractResult ExtractPayload(string packageSourcePath, string stagingRoot)
{
if (Directory.Exists(packageSourcePath))
{
return StagePayloadFromDirectory(packageSourcePath, stagingRoot);
}
if (File.Exists(packageSourcePath))
{
return StagePayloadFromDeployableZip(packageSourcePath, stagingRoot);
}
return FoPayloadExtractResult.Fail($"Dynamics 365 FO package source does not exist: {packageSourcePath}");
}
private static FoPayloadExtractResult StagePayloadFromDeployableZip(string deployablePackagePath, string stagingRoot)
{
using var outerArchive = ZipFile.OpenRead(deployablePackagePath);
var innerZipEntry = outerArchive.Entries
.FirstOrDefault(entry => IsInnerPayloadZip(entry.FullName));
if (innerZipEntry is null)
{
return FoPayloadExtractResult.Fail("Could not find payload zip under AOSService/Packages/files/*.zip.");
}
using var innerZipBuffer = new MemoryStream();
using (var innerZipEntryStream = innerZipEntry.Open())
{
innerZipEntryStream.CopyTo(innerZipBuffer);
}
innerZipBuffer.Position = 0;
using var innerArchive = new ZipArchive(innerZipBuffer, ZipArchiveMode.Read, leaveOpen: false);
var xrefEntry = innerArchive.Entries
.FirstOrDefault(entry => IsRootXref(entry.FullName));
if (xrefEntry is null)
{
return FoPayloadExtractResult.Fail("Could not find root *.xref file in payload zip.");
}
var xrefFileName = Path.GetFileName(NormalizeZipPath(xrefEntry.FullName));
var packageId = Path.GetFileNameWithoutExtension(xrefFileName);
if (string.IsNullOrWhiteSpace(packageId))
{
return FoPayloadExtractResult.Fail("Could not determine package id from root .xref file.");
}
var dllEntryPath = $"bin/Dynamics.AX.{packageId}.dll";
var dllEntry = innerArchive.Entries
.FirstOrDefault(entry => string.Equals(NormalizeZipPath(entry.FullName), dllEntryPath, StringComparison.OrdinalIgnoreCase));
if (dllEntry is null)
{
return FoPayloadExtractResult.Fail($"Could not find '{dllEntryPath}' in payload zip.");
}
Directory.CreateDirectory(stagingRoot);
var presentRoots = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var entry in innerArchive.Entries)
{
var normalized = NormalizeZipPath(entry.FullName);
if (IsDirectory(entry.FullName))
{
if (IsSelectedPayloadPath(normalized))
{
AddPresentRoot(normalized, presentRoots);
EnsureDirectoryEntry(normalized, stagingRoot);
}
continue;
}
if (ShouldExcludePayloadPath(normalized))
{
continue;
}
if (string.Equals(normalized, NormalizeZipPath(xrefEntry.FullName), StringComparison.OrdinalIgnoreCase) ||
IsSelectedPayloadPath(normalized))
{
AddPresentRoot(normalized, presentRoots);
ExtractEntry(entry, stagingRoot);
}
}
EnsureIncludedFoldersMaterialized(stagingRoot, presentRoots);
var extractedDllPath = Path.Combine(stagingRoot, dllEntryPath.Replace('/', Path.DirectorySeparatorChar));
var versionResult = ReadNugetVersionFromFileVersion(extractedDllPath);
if (!versionResult.Success)
{
return FoPayloadExtractResult.Fail(versionResult.Error!);
}
var payload = new FoPayloadInfo(packageId, versionResult.Version!, xrefFileName, presentRoots);
return FoPayloadExtractResult.Ok(payload);
}
private static FoPayloadExtractResult StagePayloadFromDirectory(string sourceDirectory, string stagingRoot)
{
Directory.CreateDirectory(stagingRoot);
var xrefPath = Directory.EnumerateFiles(sourceDirectory, "*.xref", SearchOption.TopDirectoryOnly)
.OrderBy(path => path, StringComparer.OrdinalIgnoreCase)
.FirstOrDefault();
if (string.IsNullOrWhiteSpace(xrefPath))
{
return FoPayloadExtractResult.Fail("Could not find root *.xref file in Dynamics 365 FO source directory.");
}
var xrefFileName = Path.GetFileName(xrefPath);
var packageId = Path.GetFileNameWithoutExtension(xrefFileName);
if (string.IsNullOrWhiteSpace(packageId))
{
return FoPayloadExtractResult.Fail("Could not determine package id from root .xref file.");
}
var presentRoots = CopyDirectoryPayload(sourceDirectory, stagingRoot, xrefPath);
EnsureIncludedFoldersMaterialized(stagingRoot, presentRoots);
var dllPath = Path.Combine(stagingRoot, "bin", $"Dynamics.AX.{packageId}.dll");
var versionResult = ReadNugetVersionFromFileVersion(dllPath);
if (!versionResult.Success)
{
return FoPayloadExtractResult.Fail(versionResult.Error!);
}
var payload = new FoPayloadInfo(packageId, versionResult.Version!, xrefFileName, presentRoots);
return FoPayloadExtractResult.Ok(payload);
}
private static bool IsInnerPayloadZip(string fullName)
{
var normalized = NormalizeZipPath(fullName);
return normalized.StartsWith("AOSService/Packages/files/", StringComparison.OrdinalIgnoreCase) &&
normalized.EndsWith(".zip", StringComparison.OrdinalIgnoreCase);
}
private static bool IsRootXref(string fullName)
{
if (IsDirectory(fullName))
{
return false;
}
var normalized = NormalizeZipPath(fullName);
return !normalized.Contains('/') && normalized.EndsWith(".xref", StringComparison.OrdinalIgnoreCase);
}
private static void ExtractEntry(ZipArchiveEntry entry, string rootPath)
{
var normalized = NormalizeZipPath(entry.FullName);
var destinationPath = Path.GetFullPath(Path.Combine(rootPath, normalized.Replace('/', Path.DirectorySeparatorChar)));
var rootFullPath = Path.GetFullPath(rootPath) + Path.DirectorySeparatorChar;
if (!destinationPath.StartsWith(rootFullPath, StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException($"Entry path escapes staging root: {entry.FullName}");
}
var destinationDirectory = Path.GetDirectoryName(destinationPath);
if (!string.IsNullOrWhiteSpace(destinationDirectory))
{
Directory.CreateDirectory(destinationDirectory);
}
using var source = entry.Open();
using var destination = File.Create(destinationPath);
source.CopyTo(destination);
}
private static void EnsureDirectoryEntry(string normalizedPath, string rootPath)
{
var relativePath = normalizedPath.TrimEnd('/');
var destinationPath = Path.GetFullPath(Path.Combine(rootPath, relativePath.Replace('/', Path.DirectorySeparatorChar)));
var rootFullPath = Path.GetFullPath(rootPath) + Path.DirectorySeparatorChar;
if (!destinationPath.StartsWith(rootFullPath, StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException($"Directory path escapes staging root: {normalizedPath}");
}
Directory.CreateDirectory(destinationPath);
}
private static void EnsureIncludedFoldersMaterialized(string stagingRoot, IReadOnlySet<string> presentRoots)
{
foreach (var root in presentRoots)
{
var rootPath = Path.Combine(stagingRoot, root);
Directory.CreateDirectory(rootPath);
var hasFiles = Directory.EnumerateFiles(rootPath, "*", SearchOption.AllDirectories).Any();
if (hasFiles)
{
continue;
}
var placeholderPath = Path.Combine(rootPath, EmptyFolderPlaceholderFileName);
if (!File.Exists(placeholderPath))
{
File.WriteAllText(placeholderPath, string.Empty, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
}
}
}
private static HashSet<string> CopyDirectoryPayload(string sourceDirectory, string stagingRoot, string xrefPath)
{
var presentRoots = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
File.Copy(xrefPath, Path.Combine(stagingRoot, Path.GetFileName(xrefPath)), overwrite: true);
foreach (var root in IncludedRootFolders)
{
var sourceRoot = Path.Combine(sourceDirectory, root);
if (!Directory.Exists(sourceRoot))
{
continue;
}
presentRoots.Add(root);
foreach (var directory in Directory.EnumerateDirectories(sourceRoot, "*", SearchOption.AllDirectories))
{
var relative = Path.GetRelativePath(sourceDirectory, directory);
Directory.CreateDirectory(Path.Combine(stagingRoot, relative));
}
foreach (var file in Directory.EnumerateFiles(sourceRoot, "*", SearchOption.AllDirectories))
{
if (ShouldExcludePayloadPath(Path.GetRelativePath(sourceDirectory, file).Replace(Path.DirectorySeparatorChar, '/')))
{
continue;
}
var relative = Path.GetRelativePath(sourceDirectory, file);
var destination = Path.Combine(stagingRoot, relative);
var destinationDirectory = Path.GetDirectoryName(destination);
if (!string.IsNullOrWhiteSpace(destinationDirectory))
{
Directory.CreateDirectory(destinationDirectory);
}
File.Copy(file, destination, overwrite: true);
}
}
return presentRoots;
}
private static void ExportPackInputs(string stagingRoot, string outputFolder, FoPayloadInfo payload)
{
Directory.CreateDirectory(outputFolder);
var stagedXrefPath = Path.Combine(stagingRoot, payload.XrefFileName);
var outputXrefPath = Path.Combine(outputFolder, payload.XrefFileName);
File.Copy(stagedXrefPath, outputXrefPath, overwrite: true);
foreach (var root in payload.PresentRoots)
{
var sourceRoot = Path.Combine(stagingRoot, root);
if (!Directory.Exists(sourceRoot))
{
continue;
}
var destinationRoot = Path.Combine(outputFolder, root);
CopyDirectoryContents(sourceRoot, destinationRoot);
}
}
private static void CopyDirectoryContents(string sourceRoot, string destinationRoot)
{
Directory.CreateDirectory(destinationRoot);
foreach (var directory in Directory.EnumerateDirectories(sourceRoot, "*", SearchOption.AllDirectories))
{
var relative = Path.GetRelativePath(sourceRoot, directory);
Directory.CreateDirectory(Path.Combine(destinationRoot, relative));
}
foreach (var file in Directory.EnumerateFiles(sourceRoot, "*", SearchOption.AllDirectories))
{
var relative = Path.GetRelativePath(sourceRoot, file);
var destination = Path.Combine(destinationRoot, relative);
var destinationDirectory = Path.GetDirectoryName(destination);
if (!string.IsNullOrWhiteSpace(destinationDirectory))
{
Directory.CreateDirectory(destinationDirectory);
}
File.Copy(file, destination, overwrite: true);
}
}
private static VersionReadResult ReadNugetVersionFromFileVersion(string dllPath)
{
if (!File.Exists(dllPath))
{
return VersionReadResult.Fail($"Expected DLL not found after extraction: {dllPath}");
}
var fileInfo = FileVersionInfo.GetVersionInfo(dllPath);
var candidate = fileInfo.FileVersion;
if (string.IsNullOrWhiteSpace(candidate))
{
candidate = fileInfo.ProductVersion;
}
if (string.IsNullOrWhiteSpace(candidate))
{
return VersionReadResult.Fail($"Could not read file version from '{Path.GetFileName(dllPath)}'.");
}
var match = VersionPattern.Match(candidate);
if (!match.Success)
{
return VersionReadResult.Fail($"File version '{candidate}' is not a valid NuGet version.");
}
return VersionReadResult.Ok(match.Value);
}
private static string NormalizeZipPath(string path)
=> path.Replace('\\', '/').TrimStart('/');
private static bool IsDirectory(string path)
=> path.EndsWith("/", StringComparison.Ordinal) || path.EndsWith("\\", StringComparison.Ordinal);
private static string? ResolvePackedNupkgPath(string outputFolder, string packageId, string version)
{
var rawPath = Path.Combine(outputFolder, $"{packageId}.{version}.nupkg");
if (File.Exists(rawPath))
{
return rawPath;
}
var normalizedVersion = NormalizeVersionForNupkgFileName(version);
var normalizedPath = Path.Combine(outputFolder, $"{packageId}.{normalizedVersion}.nupkg");
if (File.Exists(normalizedPath))
{
return normalizedPath;
}
return null;
}
private static string NormalizeVersionForNupkgFileName(string version)
{
if (string.IsNullOrWhiteSpace(version))
{
return version;
}
var dashIndex = version.IndexOf('-');
var plusIndex = version.IndexOf('+');
var suffixIndex = dashIndex >= 0 && plusIndex >= 0
? Math.Min(dashIndex, plusIndex)
: Math.Max(dashIndex, plusIndex);
var core = suffixIndex >= 0 ? version[..suffixIndex] : version;
var suffix = suffixIndex >= 0 ? version[suffixIndex..] : string.Empty;
var parts = core.Split('.', StringSplitOptions.RemoveEmptyEntries).ToList();
while (parts.Count > 3 && string.Equals(parts[^1], "0", StringComparison.Ordinal))
{
parts.RemoveAt(parts.Count - 1);
}
return string.Join('.', parts) + suffix;
}
private static bool IsSelectedPayloadPath(string normalizedPath)
=> IncludedRootFolders.Any(root =>
normalizedPath.StartsWith(root + "/", StringComparison.OrdinalIgnoreCase));
private static bool ShouldExcludePayloadPath(string normalizedPath)
=> normalizedPath.EndsWith(".delete", StringComparison.OrdinalIgnoreCase);
private static bool MatchesFilter(string folderName, string? filter)
{
if (string.IsNullOrWhiteSpace(filter))
{
return true;
}
var pattern = "^" + Regex.Escape(filter)
.Replace("\\*", ".*")
.Replace("\\?", ".") + "$";
return Regex.IsMatch(folderName, pattern, RegexOptions.IgnoreCase);
}
private static void AddPresentRoot(string normalizedPath, ISet<string> presentRoots)
{
var root = normalizedPath.Split('/', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
if (!string.IsNullOrWhiteSpace(root) && IncludedRootFolders.Contains(root, StringComparer.OrdinalIgnoreCase))
{
presentRoots.Add(root);
}
}
private static NuspecWriteResult WriteNuspec(string nuspecPath, string packageId, string version, string xrefFileName, IReadOnlySet<string> presentRoots)
{
try
{
var ns = XNamespace.Get("http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd");
var fileElements = new List<XElement>();
foreach (var root in IncludedRootFolders.Where(root => presentRoots.Contains(root)))
{
fileElements.Add(new XElement(ns + "file",
new XAttribute("src", root + "\\**"),
new XAttribute("target", root)));
}
fileElements.Add(new XElement(ns + "file",
new XAttribute("src", xrefFileName),
new XAttribute("target", string.Empty)));
var document = new XDocument(
new XDeclaration("1.0", "utf-8", null),
new XElement(ns + "package",
new XElement(ns + "metadata",
new XElement(ns + "id", packageId),
new XElement(ns + "version", version),
new XElement(ns + "title", packageId),
new XElement(ns + "authors", packageId),
new XElement(ns + "owners", packageId),
new XElement(ns + "requireLicenseAcceptance", "false"),
new XElement(ns + "description", "Compiled artifacts extracted from a Dynamics 365 FO deployable package."),
new XElement(ns + "tags", packageId)),
new XElement(ns + "files", fileElements)));
var settings = new XmlWriterSettings
{
Indent = true,
Encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false),
OmitXmlDeclaration = false,
NewLineChars = "\r\n",
NewLineHandling = NewLineHandling.Replace
};
using var writer = XmlWriter.Create(nuspecPath, settings);
document.Save(writer);
return NuspecWriteResult.Ok();
}
catch (Exception ex)
{
return NuspecWriteResult.Fail($"Failed writing nuspec '{nuspecPath}': {ex.Message}");
}
}
private sealed record FoPayloadInfo(string PackageId, string Version, string XrefFileName, IReadOnlySet<string> PresentRoots);
private sealed record FoPayloadExtractResult(bool Success, FoPayloadInfo? Payload, string? Error)
{
public static FoPayloadExtractResult Ok(FoPayloadInfo payload) => new(true, payload, null);
public static FoPayloadExtractResult Fail(string error) => new(false, null, error);
}
private sealed record VersionReadResult(bool Success, string? Version, string? Error)
{
public static VersionReadResult Ok(string version) => new(true, version, null);
public static VersionReadResult Fail(string error) => new(false, null, error);
}
}
internal sealed record FoDeployablePackResult(bool Success, string? PackageId, string? Version, string? NupkgPath, string? Error)
{
public string? ExportedNuspecPath { get; init; }
public static FoDeployablePackResult Ok(string packageId, string version, string nupkgPath, string? exportedNuspecPath)
=> new(true, packageId, version, nupkgPath, null)
{
ExportedNuspecPath = exportedNuspecPath
};
public static FoDeployablePackResult Fail(string error)
=> new(false, null, null, null, error);
}