msbuild DeployOnBuild=true argument not working - visual-studio-2012

I am trying to automatically publish all the projects of my .NET solution using the DeplyOnBuild=true argument (according to this answer )
I typed this command in the PowerShell:
msbuild mysolultion.sln /p:Configuration=Debug;DeployOnBuild=true;
But I get the following error message :
The term 'DeployOnBuild=true' 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:59
+ msbuild mysolution.sln /p:Configuration=Debug;DeployOnBuild=true <<<< ;
+ CategoryInfo : ObjectNotFound: (DeployOnBuild=true:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I am not sure what I am doing wrong.

PowerShell is interpreting everything after your first semicolon as a separate command.
You need to use quotes:
MSBuild example.sln /p:"Configuration=Debug;DeployOnBuild=true;"
Or use separate /p parameters:
MSBuild example.sln /p:Configuration=Debug /p:DeployOnBuild=true

Related

Error while running java script in terminal using Node.js

This is the code i have written in my tut63.js file
code
console.log('Hello World');
when i type node tut63.js in terminal it was suppose to show " Hello World ".
But instead it is showing this error in terminal.
code
PS C:\Users\m\Desktop> node.tut63.js
The term 'node.tut63.js' is not recognized as the name of a cmdlet, function, script file, or oper
able program. Check the spelling of the name, or if a path was included, verify that the path is c
orrect and try again.
At line:1 char:14
node.tut63.js <<<<
CategoryInfo : ObjectNotFound: (node.tut63.js:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException

Failing to start docker image in Azure DevOps pipeline

I am getting this error:
Generating script.
Script contents:
docker run -p 9988:1433 aneste:mssql
========================== Starting Command Output ===========================
"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\31deb425-e236-4cf3-bfe7-aed9ce46dd35.cmd""
.\start : The term '.\start' 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:76
+ ... e = 'Stop'; $ProgressPreference = 'SilentlyContinue'; .\start -sa_pas ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (.\start:String) [], ParentConta
insErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
##[error]Cmd.exe exited with code '1'.
I have tried to search for a solution for a while now but can't seem to find one, not eaven sure what causes it, docker ls outputs the docker image correctly.
EDIT:
Yaml file

Get-AutomationPSCredential not Available within Azure Function App

I am getting the error below:
2020-09-17T10:05:00.724 [Error] ERROR: Error logging into WVD: The
term 'Get-AutomationPSCredential' 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.Exception :Type :
Microsoft.PowerShell.Commands.WriteErrorExceptionMessage : Error
logging into WVD: The term 'Get-AutomationPSCredential' 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.HResult :
-2146233087CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExceptionFullyQualifiedErrorId :
Microsoft.PowerShell.Commands.WriteErrorException,_TimerTrigger1_InvocationInfo
:MyCommand : _TimerTrigger1_HistoryId : 1InvocationName :
_TimerTrigger1_CommandOrigin : InternalScriptStackTrace : at <ScriptBlock>, D:\home\site\wwwroot\TimerTrigger1\run.ps1: line
158Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result:
ERROR: Error logging into WVD: The term 'Get-AutomationPSCredential'
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.Exception
:Type : Microsoft.PowerShell.Commands.WriteErrorExceptionMessage :
Error logging into WVD: The term 'Get-AutomationPSCredential' 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.HResult :
-2146233087CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExceptionFullyQualifiedErrorId :
Microsoft.PowerShell.Commands.WriteErrorException,_TimerTrigger1_InvocationInfo
:MyCommand : _TimerTrigger1_HistoryId : 1InvocationName :
_TimerTrigger1_CommandOrigin : InternalScriptStackTrace : at <ScriptBlock>, D:\home\site\wwwroot\TimerTrigger1\run.ps1: line
158Exception: Error logging into WVD: The term
'Get-AutomationPSCredential' 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.Stack:
I have seen information online that suggests it is part of the module "AzureAutomationAuthoringToolkit", but I don't understand how I install this into the environment the Function App runs in.stuff and am following a blog post below to try and get the auto-start up shut down working. I am fairly certain that I have followed this correctly. To me the error suggests that the environment doesn't have the module loaded.
https://www.ciraltos.com/auto-start-and-stop-session-hosts-in-windows-virtual-desktop-spring-update-arm-edition-with-an-azure-function/
I don't think you can use the command Get-AutomationPSCredential in the azure function, it is an Internal cmdlet belongs to the internal module Orchestrator.AssetManagement.Cmdlets, it is only available when you're executing runbooks in the Azure sandbox environment, or on a Windows Hybrid Runbook Worker.
So in your case, your option is to use the script in the automation powershell runbook, then use Invoke-WebRequest in the timer trigger to invoke the web request to the webhook URL of the runbook to start the runbook(As the script should be ran every 5 mins said by author).
Invoke-WebRequest -Uri <Webhook URI> -Method Post
For more details, you could refer to the link mentioned in the Github repo.

Powershell Unable to find type [Pester.OutputTypes] on VSCode Linux

I'm working on a powershell port of Lesspass using Visual Studio Code on Linux Mint.
Test were working nicely from the IDE as of today.
From VSCode
Now When I'm on a test file and hit F5 to run the test I got:
PS ~/projects/Lesspass/Lesspass> ~/projects/Lesspass/Lesspass/src/Password.tests.ps1
Unable to find type [Pester.OutputTypes].
At ~/.local/share/powershell/Modules/Pester/4.6.0/Functions/PesterState.ps1:8 char:9
+ [Pester.OutputTypes]$Show = 'All',
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Pester.OutputTypes:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound
The Describe command may only be used from a Pester test script.
At ~/.local/share/powershell/Modules/Pester/4.6.0/Functions/Describe.ps1:234 char:9
+ throw "The $CommandName command may only be used from a Peste ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (The Describe comman\u2026Pester test script.:String) [], RuntimeException
+ FullyQualifiedErrorId : The Describe command may only be used from a Pester test script.
From makefile
However when running my test with make test it works. The task is:
.PHONY: test
test:
pwsh -Command 'Invoke-Pester -EnableExit (Get-childItem -Recurse *.tests.ps1).fullname'
I think your issue is likely the fact that you are attempting to call a pester test script on it's own rather than via the Invoke-Pester Command.
I think that if you change your call to Invoke-Pester -Script ~/projects/Lesspass/Lesspass/src/Password.tests.ps1 your error may go away.
The reason is that *.tests.ps1 files do not, on their own, know how to set up all of the background plumbing required to handle a test run. Invoke-Pester does a lot of set up before test files are run, and calling a test script directly with F5 skips that setup.
If you want to be able to press F5 to kick off a test run, what many PowerShellers do in VSCode is create a debug_entry.ps1 file on the local system, and in that file put the command Invoke-Pester -Script ~/projects/Lesspass/Lesspass/src/Password.tests.ps1. Then when you want to start a run, you switch tabs to your debug_entry.ps1 file and hit F5 and your debug script makes the correct call for you. It has the side benefit of the fact that any debugging break points you have set either in the tests file, or in the code you are testing should then be respected as well.
I also think I should also point out that in your make test script, you are using Get-ChildItem to explicitly get all of the test file paths manually and pass them to Invoke-Pester. This is not necessary. Invoke-Pester by default will always search either your current working directory, or any path that you give to it recursively to find all test files available.
For instance from the output of Get-Help Invoke-Pester is the following snippet
By default, Invoke-Pester runs all *.Tests.ps1 files in the current directory
and all subdirectories recursively. You can use its parameters to select tests
by file name, test name, or tag.
This snippet from the output of Get-Help Invoke-Pester -Examples demonstrates Invoke-Pester's ability to search sub directories of a given directory, not necessarily the current working directory for tests to run
-------------------------- EXAMPLE 11 --------------------------
PS > Invoke-Pester -Script C:\Tests -Tag UnitTest, Newest -ExcludeTag Bug
This command runs *.Tests.ps1 files in C:\Tests and its subdirectories. In those
files, it runs only tests that have UnitTest or Newest tags, unless the test
also has a Bug tag.
So in your case it would probably be easier and cleaner to change your make call to
pwsh -Command 'Invoke-Pester -EnableExit
That's assuming that your build system will set the current working directory to the root folder of your project.

The 'Run PowerShell' artifact failed to install with CommandNotFoundException

I'm trying to download and run a PowerShell script (from blob storage) using the Run Powershell artifact on an existing VM in Azure DevTest labs.
I get the following error and I assume I am doing something stupid.
& : The term './script.ps1' 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:3
+ & ./script.ps1
+ ~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (./script.ps1:String) [], Comman
dNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Here is my setup...
I have also tried the JSON array syntax, which gave the same result, and an invalid URL which gave a 404 error so it seems as if it is downloading my script but then failing to find it.
Below is info I wrote a while back.
Few items to note:
Folder structure is not supported as of this writing. Therefore, script needs to be at the root of the container
Ensure your blob is public
First you will need your file in Azure storage. Once uploaded in your container, click the file to get to its properties and copy the URL field.
As an example, I have created the following Run.ps1 script file and uploaded it to storage as a blob:
param ( [string]$drive = "c:\" )
param ( [string]$folderName = "DefaultFolderName" )
New-Item -Path $drive -Name $folderName -ItemType "directory"
Now, while adding the 'Run PowerShell' artifact to the VM, we provide the following information:
File URI(s): URL field copied from earlier step. (eg. https://myblob.blob.core.windows.net/mycontainer/Run.ps1)
Script to Run: Name of the PS1 script, (eg. Run.ps1)
Script Arguments: Arguments as you would write them at the end of your command (eg. -drive "d:\" -folderName "MyFolder")

Resources