How to Run Squirrel Releasify on Visual Studio Team Services? - azure-devops

I am setting up the build process for a desktop application on Visual Studio Team Services (i.e. Visual Studio Online) and would like to run the squirrel installer Releasify command automatically under some build cases. So far I have created the following powershell script that I am running after the project gets built
Write-Host "Hello World from $Env:AGENT_NAME."
Write-Host "Current Path $env:Agent_BuildDirectory"
Write-Host "Build Number $env:Build_BuildNumber"
$squirrel = "$env:Agent_BuildDirectory\packages\squirrel.windows.*\tools\Squirrel.exe"
.$squirrel -releasify "$build_dir\MyNupkg.nupkg"
This is leading to the following error message
2015-12-29T12:57:48.5701506Z ##[error]. : The term 'C:\a\1\packages\squirrel.windows.*\tools\Squirrel.exe' is not recognized as the name of a cmdlet,
2015-12-29T12:57:48.5701506Z ##[error]function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
2015-12-29T12:57:48.5701506Z ##[error]path is correct and try again.
2015-12-29T12:57:48.5701506Z ##[error]At C:\a\1\s\MyDir\Release.ps1:5 char:2
2015-12-29T12:57:48.5701506Z ##[error]+ .$squirrel -releasify "$build_dir\MyNupkg.nupkg"
2015-12-29T12:57:48.5701506Z ##[error]+ ~~~~~~~~~
2015-12-29T12:57:48.5701506Z ##[error] + CategoryInfo : ObjectNotFound: (C:\a\1\packages...ls\Squirrel.exe:String) [], CommandNotFoundException
2015-12-29T12:57:48.5701506Z ##[error] + FullyQualifiedErrorId : CommandNotFoundException
2015-12-29T12:57:48.5701506Z ##[error]
2015-12-29T12:57:48.5701506Z ##[error]Process completed with exit code 0 and had 1 error(s) written to the error stream.
How can I fix this error? Is there a better approach? Why can't powershell run a program that is in that directory?

The error is pretty clear:
It's not finding the file in the path you're specifying, which is: C:\a\1\packages\squirrel.windows.*\tools\Squirrel.exe
Correct the path to point to the correct folder.

"$env:Agent_BuildDirectory" is the local path on the agent where all folders for a given build definition are created. It isn't the complete path for your project solution. You need to use the path "$env:BUILD_SOURCESDIRECTORY\\" to navigate to packages folder. So update the script to following should fix your problem:
$squirrel = "$env:BUILD_SOURCESDIRECTORY\<project name>\packages\squirrel.windows.*\tools\Squirrel.exe"

Related

visual studio code touch command not recognized

Visual Studio Code is not recognizing the touch index.html command . It used to work. Now I get this error:
PS C:\Users\kimim_000\mynewprofile> touch index.html
touch : The term 'touch' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
touch index.html
+ CategoryInfo : ObjectNotFound: (touch:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I had the same issue as well. I used "code" in place of "touch" to create my file.
Are you using PowerShell?
I think this answer explains it well if you are.
https://stackoverflow.com/a/67665941/15102120
Basically, touch isn't a PowerShell or Windows command. The command if this is the issue is New-Item or Get-Item

Why do I have a terminal error in VS Code?

I'm trying to learn Python using VS Code. Onde of my task is to opne a file from folder in VS Code nad then run a terminal but when I'm opening it i have error like below in temrinal
PS C:\Users\Łukasz\Desktop\Exercise Files> & C:/Users/ukasz/AppData/Local/Programs/Python/Python39/python.exe "c:/Users/ukasz/Desktop/Exercise Files/Chap02/02_07_begin.py"
& : The term 'C:/Users/ukasz/AppData/Local/Programs/Python/Python39/python.exe' is not recognized as the name of a cmdlet, function, script file, or operable progra
m. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3
+ & C:/Users/ukasz/AppData/Local/Programs/Python/Python39/python.exe "c ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:/Users/ukasz/...on39/python.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\Łukasz\Desktop\Exercise Files>
Could you explain me what I'm doing wrong? I'm not sure what's wrong in the file path and what I can change. I was just adding a file from my desktop, and also just installing a Python on my computer, nothing more.
If it help - I'm learning from the Linkedin Learnign, so I'm just trying to do what they say ;)

I want to create my first test using testcafe but getting error as below

I am writing my first test using testcafe in visual studio code but getting this error "import: The term 'import' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ import { Selector } from 'testcafe';
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (import:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException"
It looks like you run your tests incorrectly. The error you provided is a Powershell error and it is not related to TestCafe.
The command should be testcafe chrome test.js.
Please share your test code and specify the way how you start your tests.
Please also take a look at the following article: https://devexpress.github.io/testcafe/documentation/getting-started/

How to run IoTCorePShell.cmd

I try to port Prolific USB to COM converter for solve my other problem: List UART -> COM converter in Windows Device Portal
I found this manual: https://learn.microsoft.com/en-us/windows/iot-core/learn-about-hardware/peripheraldrivers and copied all necessary files to separate folder:
oem6.inf
ser2pl64.sys
serenum.sys
I installed:
Windows 10 IoT Core Packages
Windows Assessment and Deployment Kit including Windows PE add-on
Now I try to launch IoTCorePShell.cmd for run New-IoTInf2Cab as mentioned in the manual.
I tried both cmd and Power Shell, both with administrator rights and without.
In Power Shell I get:
PS C:\Users\olga\Desktop\COMDriver> New-IoTInf2Cab
New-IoTInf2Cab : The term 'New-IoTInf2Cab' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ New-IoTInf2Cab
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-IoTInf2Cab:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
How can I run New-IoTInf2Cab?
OK, it was necessary to clone the repository.
The IoTCorePShell.cmd stay in the root.
https://github.com/ms-iot/iot-adk-addonkit

Not able to execute AWS Powershell tool cmdlet in TFS Post build script

I am trying to execute the few aws cmdlet command in post build script with TFS build. I have a AWS SDK tool is installed in build controller. I am able to run the same commands manually in Build controller. But when i invoke those commands in TFS post build script. It's giving me error that its not able to find the cmdlet installed on the build controller. I tried to change the execution policy but didn't help. I have an execution policy - bypass right now. script is executing but only the commands is not able to execute. I am thinking that it's issue because of something like Execution policy. Do we need to check anything else same like execution policy while we invoke any third party cmdlet from power shell.
Commands:
Set-AWSCredentials -AccessKey -SecretKey
Set-DefaultAWSRegion -Region us-east-1
Write-S3Object -BucketName agero-source-package -File "\\b tfadfa\adfa\adf\asdf\adsf\asdf\asd\xyz.zip"
Error:
Set-DefaultAWSRegion : The term 'Set-DefaultAWSRegion' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At \\b-tfsbc001wv\c$\MV\BuildETA-API.ps1:41 char:26
+ cd "\\b-tfsbc001wv\C$" | Set-DefaultAWSRegion -Region us-east-1
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Set-DefaultAWSRegion:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Write-S3Object : The term 'Write-S3Object' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At \\b-tfsbc001wv\c$\MV\BuildETA-API.ps1:43 char:26
+ cd "\\b-tfsbc001wv\c$" | Write-S3Object -BucketName agero-source-package -File " ...
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Write-S3Object:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
From the error messages, it would appear that the AWSPowerShell module cannot be found/automatically loaded by whatever account the TFS build process is running as.
Check that the module is installed to a globally available location under which the version of PowerShell you have searches for modules or, that the path to the module folder is present in the $PSModulePath environment variable for the TFS build account.
I got the same error on my TFS Build Agent:
Set-DefaultAWSRegion : The term 'Set-DefaultAWSRegion' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
After I installed AWS Command Line Interface x64 bit (AWSCLI64) I was able to set the Set-DefaultAWSRegion by stepping over the line of code.
I was getting this error until I ran Powershell using "Run as Administrator." So the problem might be with permissions.