You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
Can't publish module to local repository since v2.1.3 #478
When I import previous build explicitly it works as expected. The problem happens with new build. I did also check it on second machine with the same result. And it does not matter if the repository is local or UNC path.
OK, it's weird. I've tried to publish other popular module - Plaster. And it works with both builds. So I did little test and reinstalled latest Pester module from PSGallery (4.8.1) but it didn't help and I can't publish it with v2.1.3.
Edit:
It looks like it is module dependent. I was lucky with Plaster. I can't publish any of the following modules with v2.1.3 to the local repository (it works with previous build though):
ImportExcel
dbatools
PoshRsJob
psake
PSScriptAnalyzer
Thanks! I can reproduce the issue. Nuget.exe is not terminating when we run it to generate the package. So far I'm not sure why, the same command-line completes just fine when run interactively.
The issue is, when building some packages nuget writes enough data to standard out to fill the buffer, then blocks. But the calling script doesn't read anything from the output until it nuget has exited. It only affects some packages because different packages produce different amounts of output from nuget/dotnet.
Reacted by Kris Borowinski, Raj Mahich and Anton Vishnyakov
2.1.3 appears to be installed in Azure Pipelines hosted agents, so I am running into this there. Maybe you can drop a word to whoever maintains that that this fix could be welcome?
I am not even sure how to upgrade, Update-Module does not appear to install a newer version there for some reason.
Edwin Young (@edyoung) nice finding. How to work around it?
Having my module publishing stuck at "VERBOSE: Performing the operation "Publish-Module" on target ....", found this thread and how scratching my head.
The issue is, when building some packages nuget writes enough data to standard out to fill the buffer, then blocks. But the calling script doesn't read anything from the output until it nuget has exited. It only affects some packages because different packages produce different amounts of output from nuget/dotnet.
In my case, I have sub-folders for my customer PowerShell module.
NuGet stuck, indeed. The dotnet.exe process stuck in the process explorer. Once killed, here is what we see in the verbose output.
Trying to find a way to trick nuget/dotnet. Placing everything into /tools sub-folder didn't work.
Now I wonder how come other
ERROR: Failed to generate the compressed file for module 'dotnet cli failed to pack M
icrosoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 275.36 ms for C:\Users\user\AppData\Local\Temp\f44
2cac3-564d-4afe-b84d-6cdc6a36d902\Temp.csproj.
Temp -> C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d-6cdc6a
36d902\bin\Debug\netcoreapp2.0\NotUsed.dll
Successfully created package 'C:\Users\user\AppData\Local\Temp\84405364
2\InvokeMyModule\InvokeMyModule.0.2.2002.1129.nupkg'.
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tas
ks.Pack.targets(198,5): warning NU5110: The script file 'InvokeMyModule.ps1' is outside
the 'tools' folder and hence will not be executed during installation of this package
. Move it into the 'tools' folder. [C:\Users\user\AppData\Local\Temp\f442
cac3-564d-4afe-b84d-6cdc6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tas
ks.Pack.targets(198,5): warning NU5111: The script file 'InvokeMyModule.ps1' is not reco
gnized by NuGet and hence will not be executed during installation of this package. R
ename it to install.ps1, uninstall.ps1 or init.ps1 and place it directly under 'tools
'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d-6cdc6a36d902
\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tas
ks.Pack.targets(198,5): warning NU5111: The script file 'tools\deploy.ps1' is not rec
ognized by NuGet and hence will not be executed during installation of this package.
Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it directly under 'tool
s'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d-6cdc6a36d90
2\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tas
ks.Pack.targets(198,5): warning NU5111: The script file 'tools\components\CloudCompon
ent.ps1' is not recognized by NuGet and hence will not be executed during installatio
n of this package. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it d
irectly under 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4a
fe-b84d-6cdc6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tas
ks.Pack.targets(198,5): warning NU5111: The script file 'tools\core\BaseClass.ps1' is
not recognized by NuGet and hence will not be executed during installation of this p
ackage. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it directly und
er 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d-6cd
c6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tas
ks.Pack.targets(198,5): warning NU5111: The script file 'tools\core\CliUtils.ps1' is
not recognized by NuGet and hence will not be executed during installation of this pa
ckage. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it directly unde
r 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d-6cdc
6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tas
ks.Pack.targets(198,5): warning NU5111: The script file 'tools\core\DeploymentContext
.ps1' is not recognized by NuGet and hence will not be executed during installation o
f this package. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it dire
ctly under 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-
b84d-6cdc6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tas
ks.Pack.targets(198,5): warning NU5111: The script file 'tools\core\DeploymentStage.p
s1' is not recognized by NuGet and hence will not be executed during installation of
this package. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it direct
ly under 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b8
4d-6cdc6a36d902\Temp.csproj]
'.
At C:\program files\powershell\6\Modules\PowerShellGet\PSModule.psm1:10810 char:17
+ ... Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
At C:\Users\user\source\repos\my-module\platform-MyModule-cli\.build-sha
red.ps1:157 char:1
+ task BuildModule {
+ ~~~~~~~~~~~~~~~~~~
At C:\Users\user\source\repos\my-module\platform-MyModule-cli\.build-sha
red.ps1:285 char:1
+ task DefaultBuild UnitTest,
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
At C:\Users\user\source\repos\my-module\platform-MyModule-cli\.build-sha
red.ps1:294 char:1
+ task . DefaultBuild
+ ~~~~~~~~~~~~~~~~~~~
Build FAILED. 8 tasks, 1 errors, 0 warnings 00:00:33.0177652
pwsh : Publish-PSArtifactUtility : Failed to generate the compressed file for
module 'dotnet cli failed to pack Microsoft (R) Build Engine version
16.4.0+e901037fe for .NET Core
At line:6 char:1
+ pwsh -c invoke-build
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Publish-PSArtif...e for .NET Core:Stri
ng) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 275.36 ms for C:\Users\user\AppData\Local\Temp\f4
42cac3-564d-4afe-b84d-6cdc6a36d902\Temp.csproj.
Temp -> C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d-6cdc6
a36d902\bin\Debug\netcoreapp2.0\NotUsed.dll
Successfully created package 'C:\Users\user\AppData\Local\Temp\8440536
42\InvokeMyModule\InvokeMyModule.0.2.2002.1129.nupkg'.
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Ta
sks.Pack.targets(198,5): warning NU5110: The script file 'InvokeMyModule.ps1' is
outside the 'tools' folder and hence will not be executed during installation of
this package.
Move it into the 'tools' folder. [C:\Users\user\AppData\Local\Temp\f442
cac3-564d-4afe-b84d-6cdc6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Ta
sks.Pack.targets(198,5): warning NU5111: The script file 'InvokeMyModule.ps1' is not
recognized by NuGet and hence will not be executed during installation of this
package. Re
name it to install.ps1, uninstall.ps1 or init.ps1 and place it directly under
'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d-6cdc6
a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Ta
sks.Pack.targets(198,5): warning NU5111: The script file 'tools\deploy.ps1' is not
recognized by NuGet and hence will not be executed during installation of this
package. R
ename it to install.ps1, uninstall.ps1 or init.ps1 and place it directly under
'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d-6cdc6
a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Ta
sks.Pack.targets(198,5): warning NU5111: The script file
'tools\components\CloudComponent.ps1' is not recognized by NuGet and hence will not
be executed during installation
of this package. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it
directly under 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-
4afe-b84d-6cdc6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Ta
sks.Pack.targets(198,5): warning NU5111: The script file 'tools\core\BaseClass.ps1'
is not recognized by NuGet and hence will not be executed during installation of
this pa
ckage. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it directly
under 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d
-6cdc6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Ta
sks.Pack.targets(198,5): warning NU5111: The script file 'tools\core\CliUtils.ps1'
is not recognized by NuGet and hence will not be executed during installation of
this pac
kage. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it directly
under 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-4afe-b84d
-6cdc6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Ta
sks.Pack.targets(198,5): warning NU5111: The script file
'tools\core\DeploymentContext.ps1' is not recognized by NuGet and hence will not be
executed during installation of
this package. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it
directly under 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-
4afe-b84d-6cdc6a36d902\Temp.csproj]
C:\Program Files\dotnet\sdk\3.1.101\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Ta
sks.Pack.targets(198,5): warning NU5111: The script file
'tools\core\DeploymentStage.ps1' is not recognized by NuGet and hence will not be
executed during installation of t
his package. Rename it to install.ps1, uninstall.ps1 or init.ps1 and place it
directly under 'tools'. [C:\Users\user\AppData\Local\Temp\f442cac3-564d-
4afe-b84d-6cdc6a36d902\Temp.csproj]
'.
At C:\program files\powershell\6\Modules\PowerShellGet\PSModule.psm1:10810 char:17
+ ... Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : FailedToCreateCompressedModule,Publish-PSArtifactUtility
Feels that we might need to suppress output warnings by dotnet pack for some warning. These might be exactly the warning which go to the output and locking dotnet.exe.
Looking into how the output is read, it indeed can get full and async read might help. Similar challenge mentioned on SO:
Activity
edyoung commentedon May 14, 2019
That's quite odd. If you explicitly run the previous build (import-module powershellget -requiredversion ...) does the issue reproduce?
kborowinski commentedon May 14, 2019
When I import previous build explicitly it works as expected. The problem happens with new build. I did also check it on second machine with the same result. And it does not matter if the repository is local or UNC path.
kborowinski commentedon May 14, 2019
OK, it's weird. I've tried to publish other popular module - Plaster. And it works with both builds. So I did little test and reinstalled latest Pester module from PSGallery (4.8.1) but it didn't help and I can't publish it with v2.1.3.
Edit:
It looks like it is module dependent. I was lucky with Plaster. I can't publish any of the following modules with v2.1.3 to the local repository (it works with previous build though):
ImportExcel
dbatools
PoshRsJob
psake
PSScriptAnalyzer
edyoung commentedon May 15, 2019
Thanks! I can reproduce the issue. Nuget.exe is not terminating when we run it to generate the package. So far I'm not sure why, the same command-line completes just fine when run interactively.
edyoung commentedon May 15, 2019
The issue is, when building some packages nuget writes enough data to standard out to fill the buffer, then blocks. But the calling script doesn't read anything from the output until it nuget has exited. It only affects some packages because different packages produce different amounts of output from nuget/dotnet.
sandersaares commentedon Dec 15, 2019
2.1.3 appears to be installed in Azure Pipelines hosted agents, so I am running into this there. Maybe you can drop a word to whoever maintains that that this fix could be welcome?
I am not even sure how to upgrade, Update-Module does not appear to install a newer version there for some reason.
User PowerShellGet >= 2.2.3
Require build to use PowerShellGet version >= 2.2.3
avishnyakov commentedon Feb 12, 2020
Edwin Young (@edyoung) nice finding. How to work around it?
Having my module publishing stuck at "VERBOSE: Performing the operation "Publish-Module" on target ....", found this thread and how scratching my head.
avishnyakov commentedon Feb 12, 2020
In my case, I have sub-folders for my customer PowerShell module.
NuGet stuck, indeed. The dotnet.exe process stuck in the process explorer. Once killed, here is what we see in the verbose output.
Trying to find a way to trick nuget/dotnet. Placing everything into /tools sub-folder didn't work.
Now I wonder how come other
avishnyakov commentedon Feb 12, 2020
Edwin Young (@edyoung) I might be wrong but maybe we might need to add something like for the PR https://github.com/PowerShell/PowerShellGet/pull/479 while generating $CsprojContent?
https://github.com/PowerShell/PowerShellGet/pull/479/files#diff-8a5643a86665a53bd2054068d6f33fe5R60
Feels that we might need to suppress output warnings by dotnet pack for some warning. These might be exactly the warning which go to the output and locking dotnet.exe.
Looking into how the output is read, it indeed can get full and async read might help. Similar challenge mentioned on SO:
avishnyakov commentedon Feb 13, 2020
Same issue under linux container, azuresdk/azure-powershell-core with dotnet-sdk 3.1