Friday, November 13, 2020

Sitecore 10 - ASP.NET core rendering engine - Fix for Error - 'Invoke-WebRequest' is not recognized as an internal or external command

During the ASP.NET core rendering engine setup, I found below error 


I updated the docker file for the absolute path "RUN Invoke-WebRequest 'https;//dist.nuget.org/win-x86-commonadline/v5.6.0/nuget.exe' - UserBasicPrasing -OutFile ''C;\ProgramFiles\NugGet\nuget.exe" but it didn't work.

Error - 'Invoke-WebRequest' is not recognized as an internal or external command

My current PowerShell version was 5.1

I tried run this command through the plain PowerShell window, As suggested by Sitecore community and it worked for me - 

$Url = 'https://www.google.com/search?q=jitendra%20soni%20sitecore'
$Web = Invoke-WebRequest -Uri $Url -UseBasicParsing
$Web.BaseResponse.ResponseUri.AbsoluteUri

I used the above command for the testing.

I was discussing in the Sitecore slack thread and as suggested by Vincen and Maarten, I found this link useful 


Conclusion and fix - basically to make it work, I had to modify the script to set the default shell to PowerShell,


I was thinking to provide this fix into the Sitecore main GitHub repository but found that this had already fixed by our community legend GuidovTricht 

As always, Don't forget to appreciate the hard work and contribution of our community members, so I added my comments.



No comments:

Post a Comment