Syntax: Setting the environment variables in Visual Studio 2008 - visual-studio

I have been trying to add some environment variables in the Visual Studio 2008 for debugging purpose.
This is because I got this warning:
Warning The following environment variables were not found:
$(DEV_PATH)
$(APPFRAMEWORK_INC)
Here's what I did:
I went to Project > Properties > Configuration Properties > Debugging > Environment
And I have tried adding the following (one by one):
DEV_PATH="\ProjectName\source\"
"DEV_PATH=\ProjectName\source\"
$(DEV_PATH)="\ProjectName\source\"
"$(DEV_PATH)=\ProjectName\source\"
Because this is the path I need to set.
But unfortunately it does not work.
What exactly is the syntax?
As per the link: http://msdn.microsoft.com/en-us/library/ms173406.aspx, it is:
DEV_PATH=\ProjectName\source
But, I need to add multiple such environment variables; so, what must be the separator?
Also, please don't tell me that I can right-click on "My Computer" and modify the environment variables there; I want these environment variables only temporarily for this workspace specifically.

I have written a script that looks like:
set DEV_PATH=\ProjectName\source
set APPFRAMEWORK_INC=\ProjectName\app\framework\inc
And I run the script in a command console before launching Visual Studio.
Hence, the environment variables are temporary, as they are lost as soon as the console and Visual Studio windows are closed.

I have found that this can happen if you have a pending Windows Update. Rebooting seems to fix the problem, as then the Update gets a chance to be applied.

Related

Passing Environment Variables to Docker Container When Running in Visual Studio

We have a .NET Core project in Visual Studio (2017) that has Docker support added. Our project relies on environment variables to configure itself at start up. As we understand it, in order to pass environment variable values to a container you specify them as arguments to the docker run command using -e.
When you run the containerized version of the project from Visual Studio by selecting the Docker profile, we noticed that Visual Studio executes a docker run command. However, we've not been able to figure out how to get Visual Studio to include our environment variable values when it runs the container.
Is there a way to tell Visual Studio to pass our environment variable values to a container it runs?
Note that we do not want to specify the environment variable values in the image since the values will change depending on where it is deployed to.
You can choose to include additional environment files to be passed to the docker run command by adding the following property to your .csproj file:
<DockerfileRunEnvironmentFiles>your_env_file.env</DockerfileRunEnvironmentFiles>
I have a command line .NET Core application that consumes a secret in the input arguments, like
mycli -ACCOUNT_KEY abcdef123=. For debugging purposes, I don't want to have this value in my source countrol, so I set it as an environment variable on my system that I'm then passing in the command line arguments. This is what I did:
In the system environment variables:
In the project settings:
In the .csproj file:
In the .gitignore:
In case your env variable does not change frequently, you can also put them in the Docker file , during the image-building process the env variable will be assigned to the container
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
ENV ASPNETCORE_ENVIRONMENT=dev

Setting environment variables at Qt Creator by sourcing a shell script

I am trying to configure the "Run Settings" on Qt Creator 3.0.1.
I would like to set the value of many environment variables by sourcing a shell script 'myScript'.
However, Deployment's Custom Process Step apparently doesn't accept 'source' as a command.
If I execute the script instead of sourcing it, it sets the environment variables of the shell process in which it is executed, which is not the same where Qt Creator runs the executable.
Is it possible to use 'myScript' to configure the environment variables ? How should I call it?
Ofcorse, You can run qt via scrypt. This is very simply. My script is below. Ofcorse you need environment variables in concret file. In my case this file is environment-setup
#!/bin/bash
echo "ustawienie zmiennej /usr/local/angstrom/arm/environment-setup"
# set concret variables important is . /
. /usr/local/angstrom/arm/environment-setup
echo "Uruchomienie qtCreator"
# lunched qtcreator
$HOME/Qt/Tools/QtCreator/bin/qtcreator
You also can set this script as linked to main icon qt in your start menu. After this, all you need to run qt is only click in your shortcut in menu
I think currently there's no proper way to set QtCreator build environment variables using a script. For example in this guide by ICS three options are mentioned in the "Set Up the Environment" section:
1. You can always start Qt Creator in the same shell/console session where you previously ran the environment setup script (i.e. /opt/poky/2.2.1/environment-setup-armv5e-poky-linux-gnueabi). This option is the easiest, but means that you can’t simply launch Qt Creator from a desktop shortcut or similar method. It might also cause problems if you want to build for the desktop or another embedded platform within the same session.
2. You can add the environment variables to the kit’s settings. This option is a little more work to set up, but avoids the issues of the shell setup.
3. A third option is to add the environment variables to your project settings, but that means adding it to every project that uses the kit.

Jenkins is not picking up Environment variable to be used in windows batch script

I am building a visual studio solution containing number of project. I wanted to disable multiprocess build, so , i tried setting an enviroment variable CL to /MP1. But it didn't worked in Jenkins while working in running the batch script for building solution using command line.
Good morning,
Log to your Jenkins server, and stop the Jenkins from the command line. While doing this, open your web-browser and refresh the Jenkins webpage to make sure it stopped(it will take around 5 seconds to stop the service). Then start again from the command line, it will update the variable. I did yesterday, to run my unit tests. It should work.
To set environment variables for individual projects, use the checkbox 'Prepare an environment for the run' and set what environment variables you want in the format 'ENV=value' in the Properties content box.
Otherwise, all I can suggest is that you haven;t restarted the Jenkins service after setting your variable in Windows.
You can also used the EnvInject plugin, it works well.
https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

Sass compiler not working in sublime text 3

I have Sass installed on my Windows 7 machine and I'm trying to compile some scss.
Each time, I get the following output:
'sass' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.2s with exit code 1]
[cmd: ['sass', '--update', 'W:\\exocet\\web\\build\\mirror\\css\\style.scss:W:\\exocet\\web\\build\\mirror\\css/style.css', '--stop-on-error', '--no-cache']]
[dir: W:\exocet\web\build\mirror\css]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\EgisTec\MyWinLocker 3\x86;C:\Program Files (x86)\EgisTec\MyWinLocker 3\x64;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files (x86)\QuickTime\QTSystem\]
What appears to be the problem?
Thankfully, I found the answer here...
If you are receiving the 'sass is not recognized as an internal or
external command' error... ...and have Sass installed, you have to add
it to your system's PATH variable.
At the end of the string, add ;C:\Ruby192\bin.
Instructions for altering PATH variable can be found here.
Windows Vista and Windows 7 users:
From the Desktop, right-click My Computer and click Properties.
Click Advanced System Settings link in the left column.
In the System Properties window click the Environment Variables button.
Windows 2000 and Windows XP users:
The path is now managed by Windows 2000 and Windows XP and not the autoexec.bat
or autoexec.nt files as was done with earlier versions of Windows.
To change the system environment variables, follow the below steps.
From the Desktop, right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
C:\Program Files;C:\Winnt;C:\Winnt\System32
Note that the numbers "192" given in the example in the first link ( ;C:\Ruby192\bin ) will differ for each version of Ruby.

TeamCity Agent has "lost" its environment path

I've been happily working with a TeamCity Build server for a while now, but all of a sudden things went wrong...
It seems the build agent no longer has anything in it's path. So, for example, if my build script (I use NANT) calls xcopy to copy files, this has suddenly started failing because xcopy can not be found - so the build will fail unless I change it to c:\windows\system32\xcopy.
I can manually browse to the build agent folder and run the nant script from there, and it all works (because the path is set correctly).
I've not upgraded TeamCity, so I'm baffled as to why this could have borked. I don't override anything in the environment parameters of the builds in TeamCity. I've not changed anything in the build settings either. The only thing I've done to this PC that contains the build agent is to install the RC of Visual Studio 2012.
Any ideas?
EDIT
Further investigation - I've found the agent settings in TeamCity - in there the environment variable called "path" is just set to C:\Program Files (x86)\Nmap (Recently installed). This is odd and quite possibly the cause of the issue. I just need to work out how to make TeamCity revert to the "real" path.
Figured it out - this may well be useful to someone else...
When I installed Nmap recently, it added a new "User Variable" for my account, which it called "path" and set to C:\Program Files (x86)\Nmap. This overrides the "System Variable" called path, and was causing all the havoc. Removed the user variable, and all working.

Resources