run cmake in PowerShell instead of cmd - teamcity

Running CMake configure runner in a Windows uses cmd.exe shell. Is there a way to make CMake configure use PowerShell?
TeamCity Enterprise 2022.04.4 (build 108763)

Related

vscode terminal doesn't recognize externals

I can't run external commands in the terminal like I can in cmd.exe
I am using vscode 1.50.1
I have environment variable PATH set to:
C:\Program Files\dotnet;C:\Python\Python36\Scripts;C:\Python\Python36;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;C:\Program Files\MongoDB\Server\3.6\bin;C:\Users\axw04\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\nodejs;C:\Windows\System32;C:\Program Files\Git\bin;C:\Program Files\Java\jre1.8.0_191\bin;C:\Users\axw04\AppData\Roaming\npm;%USERPROFILE%.dotnet\tools;C:\Users\axw04.platformio\penv\Scripts;
In the normal cmd.exe I can run the dotnet command without any problem:
eq. dotnet --info
But in the terminal of vscode I get an error
'dotnet' is not recognized as an internal or external command,
operable program or batch file.
I also tried switching to powershell as default shell without any luck.
I reinstalled the latest
.NET Core 3.1 SDK (v3.1.403) - Windows x64 Installer
nothing seems to work.
my system is a windows10 laptop.
I have both vscode and visual studio 2019 installed.

How to pass command line when debugging docker-compose project in Visual Studio?

I created a .Net core 2.1 console application with Linux docker support using Visual Studio 2017. I can run the application using the following command line
docker run myApp arg1 arg2
I want to debug it in VS so I set the project docker-compose as the startup project and debug run "Docker Compose" in Visual Studio. However, is there a way to set up the command line arguments? (arg1 arg2 in my example).
Unfortunately there is no easy way to do this right now because of the way VS handles debugging into docker containers.
See this issue for more info: https://github.com/Microsoft/DockerTools/issues/75

CMake add_custom_target; Cannot find 32-bit commands in Visual Studio

I am using CMake to generate my Visual Studio project files. I wanted to see if I could "trick" Visual Studio into also compiling for Linux using Bash on Ubuntu on Windows from Windows 10, so I created a small dummy project with the following CMakeLists.txt:
cmake_minimum_required (VERSION 3.5)
project(linux)
set(BASH_EXE C:/Windows/System32/bash.exe)
add_custom_target(Linux ALL
COMMAND ${BASH_EXE} -c "make -C ${CMAKE_SOURCE_DIR}/build"
)
To my surprise, this actually got the job done and created a project called Linux which ran the above command. Unfortunately that command crashed with this error:
'C:\Windows\System32\bash.exe' is not recognized as an internal or external command, operable program or batch file.
But I can run this exact command from my cmd prompt and it works fine:
C:\Windows\System32\bash.exe -c "make -C build"
Why can't Visual Studio/CMake find the bash executable?
This was probably the dumbest issue I've encountered... This blog post is what led me to the answer: http://www.samlogic.net/articles/sysnative-folder-64-bit-windows.htm
The problem was with how Windows handles 32-bit vs 64-bit programs: it keeps 64-bit programs in System32 and 32-bit programs in SysWOW64. Only 32-bit programs can see SysWOW64 and only 64-bit programs can see System32. If a 32-bit program needs a program in System32, it has to use the pseudo-folder called sysnative.
Turns out Visual Studio was launching my CMake commands in a 32-bit shell, meaning it couldn't find a program in C:/Windows/System32/
So I had to change my CMakeLists.txt to this:
cmake_minimum_required (VERSION 3.5)
project(linux)
set(BASH_EXE C:/Windows/sysnative/bash.exe)
add_custom_target(Linux ALL
COMMAND ${BASH_EXE} -c "make -C ../../build"
)
Unfortunately because of the nature of the CMAKE_SOURCE_DIR variable, I had to change this to use a relative path instead of an absolute one (CMAKE_SOURCE_DIR expands to the Windows path, not the Linux path).

msbuild continue buil solution on some project error in command line

Is any way to continue build solution from command line when error occured? Such as -i flag in make (g++) on linux.
Details: I try to build opencv 3.1.0 from VS 2010 command prompt, and have some error. In VS 2013 build and install is successful, in Linux I use -i flag for make and it allow me to continue build and install opencv without some examples. How I can do this in VS 2010 command prompt?
My command is for buils is:
msbuild /p:ContinueOnError=ErrorAndContinue /p:Configuration=Debug OpenCV.sln
PS. for create solution I use cmake.
PSS. I known that /p:ContinueOnError=ErrorAndContinue not working in this case.

Can we compile and sign a windows 8 winjs application via commandline

Is there any way to create a windows 8 winjs .appx package file using command line?
Yes! Look for the MSBuild.exe executable in the .NET Framework folder. You run it like:
MSBuild.exe your/project.jsproj /p:Configuration=Release /t:Build /m
You can use "Debug" instead of "Release" and also "Deploy" instead of build (which will install the app locally, if not previously installed).
More at the MSBuild reference.
There are some usage samples in the Rainbowdriver project, which uses MSBuild to automatically test Windows 8 JS Apps using Selenium.

Resources