appveyor - how to set environment variable using %HOMEPATH% - node-gyp

I'm working on a node.js native addon project, instead of using binding.gyp, I'm using cmake, as my project depends on another cmake project.
I can use cmake to build the target(on my own windows 7), which needs to setup environment variables to specify library path include node-gyp and mysql. I got the mysql path(from appveyor doc), please correct me if I'm wrong.
But I don't know how to set node-gyp dir in appveyor environment, which is located in ~/.node-gyp windows equivalent path. I tried below script, and it errored out at NODE_GYP_DIR line.
environment:
# set variables
NODE_GYP_VER: 0.12.7
NODE_GYP_DIR: %HOMEDRIVE%%HOMEPATH%\.node-gyp
LIBMYSQL_INCLUDE_DIR: C:\Program Files\MySql\MySQL Server 5.6\include
LIBMYSQL_LIBRARY: C:\Program Files\MySql\MySQL Server 5.6\lib
My question is, can I assume ~/.node-gyp windows equivalent path exists? How to set the path to my environment variable for my cmake? Thanks!

Use %USERPROFILE% instead:
environment:
# set variables
NODE_GYP_VER: 0.12.7
NODE_GYP_DIR: '%USERPROFILE%\.node-gyp'
LIBMYSQL_INCLUDE_DIR: C:\Program Files\MySql\MySQL Server 5.6\include
LIBMYSQL_LIBRARY: C:\Program Files\MySql\MySQL Server 5.6\lib

Related

How to get vscode-remote-ssh extension connects via git bash in windows?

I have vs code configured to use the git bash as a terminal in windows 7.
"terminal.integrated.shell.windows": "C:\Program Files\Git\bin\bash.exe"
I have enabled SSH key based authentication to remotely access a host. All this works fine from within the terminal in VS Code.
However, when using the vscode-remote SSH extension to connect to host I get an error because it tries to connect using "The terminal process command 'cmd.exe'" instead of git bash.
I've checked my terminal settings configuration in vs code and it points to git bash.exe
I've used the terminal extension in vs code and it opens a git bash and successfully connects to the host
Is there a setting that I'm missing to force Remote-SSH to use the git bash for the connection?
JerryL's answer lead me to realize, that I can simply set GIT's ssh path c:\Program Files\Git\usr\bin\ssh.exe in the remote.SSH.path setting of VS Code Preferences:
Then it just worked like a charm.
Just for clarity my VS Code version is: 1.40.0-insider (system setup)
I ran into a similar issue trying to get MS VS Code Studio Remote-SSH working with Putty's Pageant. I had Git for Windows installed and in a Git Bash shell, I could ssh and pick up the Pageant keys and no password was needed.
But VS Code Remote-SSH, while using the Git ssh in C:\Program Files\Git\usr\bin\ssh.exe was using Windows 7 cmd.exe shell which didn't talk to Pageant.
What worked for me on Windows 7, VS Code 1.36.1 with (Remote Development 0.15.0, Remote-SSH 0.44.0) and Git for Windows 2.22:
Start Pageant (C:\Program Files\PuTTY\pageant.exe) and Add key.
Start the ssh agent shim (C:\Program Files\Git\cmd\start-ssh-pageant.cmd). This takes care of the communication between Git ssh, which looks for ssh-agent, and Pageant.
Create the SSH_AUTH_SOCK environment variable
Control Panel / System / Advanced Settings / Environment Variables..
User variables for username / New..:
Variable name: SSH_AUTH_SOCK
Variable value: /tmp/.ssh-pageant-username (e.g. /tmp/.ssh-pageant-bill) (Environment Variable assignment screenshot)
Test ssh:
Open a command prompt: Enter set to view the list of Environment Variables. Is the SSH_AUTH_SOCK variable set correctly to something like /tmp/.ssh-pageant-bill?
Try ssh to your host using Git's ssh.exe: c:\Program Files\Git\usr\bin\ssh.exe user#host If this works, then VS Code Remote-SSH should work.
Finally, I added Pageant and start-ssh-pageant.cmd to my Windows 7 Startup so this persists across reboots.
Hope that helps.
Jerry.
I had a similar problem trying to get VS Code Remote use Putty Pageant.
1. Create .bat file somewhere with the following content:
echo OpenSSH
"C:\YOUR_PATH_HERE\PLINK.EXE" -ssh %*
2. Open VS Code settings, type remote ssh path in search and find Remote.SSH: Path settings
3. Past here path to your .bat file
4. Now VS Code Remote will use Pageant correctly.

'sqlpackage.exe' is not recognized as an internal or external command Error

I used maven,Microsoft SQL server management studio 17.SQL server verion is 14.0.1000.169.
When i build my project it gives following error and build failed
'sqlpackage.exe' is not recognized as an internal or external command,
operable program or batch file.
[ERROR] The following errors occured during execution:
[ERROR] 'sqlpackage.exe' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
This is my system environment path variables.
I can't find what's the wrong
I didn't have the location of sqlpackage.exe in the PATH variable. After adding it to PATH variable, had resolved the issue for me. (Something like below)
C:\Program Files\Microsoft SQL Server\140\DAC\bin
It's fixed using following steps.
You need to Install Sql server data tools
For that follow this steps.
For windows,
Install chocolatey
Install SSDT components
Add sqlpackage.exe to classpath
For Install chocolatey
https://chocolatey.org/install
For Install SSDT components
choco install sqlserver-cmdlineutils
choco install sql2014.clrtypes
choco install sql2014-sqldom
choco install sql2014-dacframework
For Add sqlpackage.exe to classpath
RUN setx PATH "%PATH%;C:\Program Files\Microsoft SQL Server\120\DAC\bin\;"
Looks like you havn't installed Data-tier Application Framework. You can download and install DacFx (17.4.1) from https://www.microsoft.com/en-us/download/details.aspx?id=56508
Adding these locations into path variable will fix both maven and gradle error if you already installed mssql server 2019.
C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin
C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn
Download Microsoft SQL Server Data-Tier Application Framework from https://www.microsoft.com/en-us/download/details.aspx?id=56508 and open Environment settings and set the PATH variable to C:\Program Files\Microsoft SQL Server\140\DAC\bin
try following:
install https://dotnet.microsoft.com/download/dotnet/3.1
install https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-download?view=sql-server-ver15
run this command in terminal in projects directory(without braces) "dotnet add package Microsoft.SqlServer.DACFx"

Not able to start solr in windows

I have downloaded solr 6.4.0 version and tried starting using solr start from bin directory I end up with following error:
C:\solr-6.4.0\bin>solr start
'findstr' is not recognized as an internal or external command,
operable program or batch file.
C:\solr-6.4.0\bin>
Could you please advise me is there any configuration that i need to do/ how to start?
Thanks.
The program findstr.exe can be found in C:\Windows\system32.
Check if you can find it there.
If it is available, modify your "path" environment variable to include the path "C:\Windows\system32\".
If you have an open command prompt window, exit and re-open it, and check that the %PATH% variable contains the newly added path.
echo %PATH%
Now "findstr.exe" should be available for Solr scripts.
Download solr + copy downloaded folder to c: drive (solr7.2.1)
Download nssm installer + copy downloaded folder to c: drive (solr)
open nssm installer in cmd:
>> cd C:\solr\nssm2.24\win64
>> nssm install solr7
GUI service Installer opens (Enter solr path details)
- C:\solr-7.2.1\bin\solr.cmd
- C:\solr-7.2.1\bin
Install (solr as service gets installed)
Set Environment Variable -> System Variables (JRE Path):
JAVA_HOME: c:\ProgramFiles\java\jre1.8.0_212
Check if solr is running (from services)
Open Solr:
https://localhost:8983/solr/#/
Actually findstr.exe is missing.
So follow these steps:
1.go to C:\Windows\system32\ and copy findstr.exe file.
2. paste this file into the location C:\Program Files\Java\jdk{version}\bin
Then run the this command:
solr.cmd start
Hope this helps.

Cant set environment variables up with ionic?

Herers my variables
ANDROID_HOME
variable: C:\Program Files\Android\android-sdk_r24.0.2-windows\android-sdk-windows
JAVA_HOME
variable: C:\Program Files\Java\jdk1.6.0_45
PATH
variable: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\ant\apache-ant-1.9.4\bin;C:\Program Files\Android\android-sdk_r24.0.2-windows\android-sdk-windows\platform-tools;C:\Program Files\Android\android-sdk_r24.0.2-windows\android-sdk-windows\tools;%ANDROID_HOME%;%JAVA_HOME%;
Now when I open putty and say echo %PATH% all I get back is "%PATH%"? Same for the other two? what am I doing wrong?
also when I try check the versions of ionic and cordova it just says no such file or dictionary? even tho I installed them?
sudo npm install -g ionic
npm seems to be working too? I set up apache but it just says build failed and build.xml does not exist when i do ant -v?
I believe that you also need to add an ANT_HOME system variable. It should just be the path to the main Ant folder (not bin), C:\ant\apache-ant-1.9.4 based on your PATH variable. As for putty and npm, I've never tried this and have only used Windows command line.
echo %PATH% should return location of file system and not variable name.
Your JAVA_HOME and ANDROID_HOME look correct.
But i don't think that #rrjohnson85 is correct for ANT, there isn't any batch files that are not in bin. Mine is set to: C:\Program Files\apache-ant-1.9.4\bin and it works.
You should try to add environment variables with full URI of location on file system and not use other environment vars inside.

DATABASE PROJECT SQLCMD -v

To control the database version, I use the Visual Studio database project but to execute the script generated by the project I use the sqlcmd.exe.
There is a variable called $(environment) in my script.postdeployment.sql that depends on the server environment (prd,uat,dev) and I use the command sqlcmd.exe -v environment="dev" to set this value to this variable. The problem is the Visual Studio throw a compilation error
SQL72008: Variable Environment is not defined.
Ok, I know why this error is trown, It is because the variable is not defined in the Prject properties (SQLCMD Variables tab), BUT if I add this variable in the project properties the value will be setted in the script overriding the value I passed in the sqlcmd.exe -v environment="dev".
For example
, If I set the $(environment) variable in the project properties as "uat" and execute sqlcmd.exe -v environment="dev", the highest precedence is the value I set in the project properties, so UAT, because the project generate the following statment in my script:
:setvar app_environment "uat"
How could I handle this issue between visual studio database project and sqlcmd.exe?
The way I have fixed this is to Set the properties of the post deployment script as follows:
Build Action: None
Copy to Output Directory: Copy always
When you do this, Visual Studio won't build the post script file, but will copy it to the /bin folder. You can then call SQLCMD twice. Once for the database creation script, and then a second time for the post build script using the -v option.

Resources