From c825ea47a14931f99e19444bbd514d75f6ebfb38 Mon Sep 17 00:00:00 2001 From: Ryan Fu Date: Fri, 17 Mar 2023 17:40:06 -0700 Subject: [PATCH 1/5] update powershell module structure and build nuget package in pipeline --- azure-pipelines.yml | 9 +++++++ .../Microsoft.WinGet.Client.csproj | 16 +++++++----- .../Module/Microsoft.WinGet.Client.nuspec | 20 ++++++++++++++ .../Module/Microsoft.WinGet.Client.psd1 | 26 +++++++++++++++---- 4 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b5f2283d68..dfec1aebd2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -383,7 +383,16 @@ jobs: Contents: '**\*' TargetFolder: '$(Build.ArtifactStagingDirectory)' + - task: NuGetCommand@2 + displayName: Create PowerShell module NuGetPackage + inputs: + command: pack + packagesToPack: '$(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client\Microsoft.WinGet.Client.nuspec' + packDestination: '$(Build.ArtifactStagingDirectory)' + - task: PublishPipelineArtifact@1 displayName: Publish PowerShell Module Artifacts inputs: targetPath: '$(Build.ArtifactStagingDirectory)' + + diff --git a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj index df46a223e8..5ea3abae9c 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj +++ b/src/PowerShell/Microsoft.WinGet.Client/Microsoft.WinGet.Client.csproj @@ -1,6 +1,7 @@  + 10.0.22000.0 net6.0-windows$(TargetWindowsVersion) net48 @@ -12,6 +13,7 @@ $(SolutionDir)$(Platform)\$(Configuration)\ $(BuildOutputDirectory)$(MSBuildProjectName) $(BuildOutputDirectory)PowerShell\Microsoft.WinGet.Client + $(PowerShellModuleOutputDirectory)\lib x64;x86;ARM64 $(CoreFramework);$(DesktopFramework) $(OutputPath)\Microsoft.WinGet.Client.xml @@ -102,8 +104,8 @@ - - + + @@ -121,17 +123,17 @@ - - - + + + - - + + diff --git a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec new file mode 100644 index 0000000000..152dad00d0 --- /dev/null +++ b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec @@ -0,0 +1,20 @@ + + + + Microsoft.WinGet.Client + 0.1.0 + Microsoft + false + MIT + https://github.com/microsoft/winget-cli + The Windows Package Manager PowerShell Module + $copyright$ + winget + + + + + + + + \ No newline at end of file diff --git a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.psd1 b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.psd1 index badf730a06..8bd4dc63e8 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.psd1 +++ b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.psd1 @@ -12,7 +12,7 @@ RootModule = 'Microsoft.WinGet.Client.psm1' # Version number of this module. -ModuleVersion = '0.0.1' +ModuleVersion = '0.1.0' # Supported PSEditions CompatiblePSEditions = 'Core' @@ -66,11 +66,27 @@ PowerShellVersion = '5.1.0' FormatsToProcess = 'Format.ps1xml' # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = if ($env:PROCESSOR_ARCHITECTURE -like 'x86') { - "x86\$PSEdition\Microsoft.WinGet.Client.dll" +NestedModules = if ($env:PROCESSOR_ARCHITECTURE -like 'x86') +{ + if ($PSEdition -eq 'Core') + { + "lib\net6.0-windows10.0.22000.0\x86\Microsoft.WinGet.Client.dll" + } + else + { + "lib\net48\x86\Microsoft.WinGet.Client.dll" + } } -else { - "x64\$PSEdition\Microsoft.WinGet.Client.dll" +else +{ + if ($PSEdition -eq 'Core') + { + "lib\net6.0-windows10.0.22000.0\x64\Microsoft.WinGet.Client.dll" + } + else + { + "lib\net48\x64\Microsoft.WinGet.Client.dll" + } } # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. From 21869ed0844cc03b12e7132336230626be74abe3 Mon Sep 17 00:00:00 2001 From: Ryan Fu Date: Fri, 17 Mar 2023 17:42:31 -0700 Subject: [PATCH 2/5] remove extra lines --- azure-pipelines.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dfec1aebd2..d420254412 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -393,6 +393,4 @@ jobs: - task: PublishPipelineArtifact@1 displayName: Publish PowerShell Module Artifacts inputs: - targetPath: '$(Build.ArtifactStagingDirectory)' - - + targetPath: '$(Build.ArtifactStagingDirectory)' \ No newline at end of file From b36b21e4f5bbd0547eaf7a911f3902a3385256f9 Mon Sep 17 00:00:00 2001 From: Ryan Fu Date: Mon, 20 Mar 2023 23:47:50 -0700 Subject: [PATCH 3/5] fix license --- .../Module/Microsoft.WinGet.Client.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec index 152dad00d0..36a5d779e7 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec +++ b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec @@ -5,7 +5,7 @@ 0.1.0 Microsoft false - MIT + https://github.com/microsoft/winget-cli/blob/master/LICENSE https://github.com/microsoft/winget-cli The Windows Package Manager PowerShell Module $copyright$ From aaeddec53723068bfb693ffa9b5c7dc5dba34fe2 Mon Sep 17 00:00:00 2001 From: Ryan Fu <69221034+ryfu-msft@users.noreply.github.com> Date: Mon, 20 Mar 2023 23:50:41 -0700 Subject: [PATCH 4/5] Fix license url --- .../Module/Microsoft.WinGet.Client.nuspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec index 152dad00d0..ede42dbdf6 100644 --- a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec +++ b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec @@ -5,7 +5,7 @@ 0.1.0 Microsoft false - MIT + https://github.com/microsoft/winget-cli/blob/master/LICENSE https://github.com/microsoft/winget-cli The Windows Package Manager PowerShell Module $copyright$ @@ -17,4 +17,4 @@ - \ No newline at end of file + From 804e899fc2aeca8ee08319c52c81a64f6a9c09a6 Mon Sep 17 00:00:00 2001 From: Ryan Fu Date: Wed, 22 Mar 2023 14:20:23 -0700 Subject: [PATCH 5/5] remove nuget spec --- azure-pipelines.yml | 9 +-------- .../Module/Microsoft.WinGet.Client.nuspec | 20 ------------------- 2 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d420254412..b5f2283d68 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -383,14 +383,7 @@ jobs: Contents: '**\*' TargetFolder: '$(Build.ArtifactStagingDirectory)' - - task: NuGetCommand@2 - displayName: Create PowerShell module NuGetPackage - inputs: - command: pack - packagesToPack: '$(Build.ArtifactStagingDirectory)\Microsoft.WinGet.Client\Microsoft.WinGet.Client.nuspec' - packDestination: '$(Build.ArtifactStagingDirectory)' - - task: PublishPipelineArtifact@1 displayName: Publish PowerShell Module Artifacts inputs: - targetPath: '$(Build.ArtifactStagingDirectory)' \ No newline at end of file + targetPath: '$(Build.ArtifactStagingDirectory)' diff --git a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec b/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec deleted file mode 100644 index 36a5d779e7..0000000000 --- a/src/PowerShell/Microsoft.WinGet.Client/Module/Microsoft.WinGet.Client.nuspec +++ /dev/null @@ -1,20 +0,0 @@ - - - - Microsoft.WinGet.Client - 0.1.0 - Microsoft - false - https://github.com/microsoft/winget-cli/blob/master/LICENSE - https://github.com/microsoft/winget-cli - The Windows Package Manager PowerShell Module - $copyright$ - winget - - - - - - - - \ No newline at end of file