Skip to content

Commit

Permalink
Improve readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Loghorn committed Mar 23, 2020
1 parent f17ff44 commit 3a9f2f2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
# SolutionEnvironment
A Visual Studio extension that provides support for customized global environment settings on a per solution basis

## Introduction

The Solution Environment extension uses a new file called SolutionName.slnenv residing in the same directory as the solution to provide build environment variables tailored to a given solution file (.slnenv stands for "solution environment").
The Solution Environment extension executes this file at solution open time, before the start of each build, and before starting the debugger, resetting the build's environment variables accordingly.

## Usage
Inside the SolutionName.slnenv file, with one entry per line, are environmentvariablename=value entries.

```
MYPATH=c:\Src\MyDirectory\Include
EXTRA_OPTS=/D MY_DEFINE
```

The solution's path is available via a variable called `$(SolutionDir)`. The solution directory does not contain a terminating backslash.
```
MYPATH=$(SolutionDir)\Include
```

The solution's name is available through `$(SolutionName)`.
```
SOLNAME=$(SolutionName)\Include
```

Environment variables may be inserted using the `$(EnvironmentVariableName)` syntax. This has the same functionality as a batch file's `%EnvironmentVariableName%` substitution syntax.
```
PATH=$(PATH);c:\Tools;$(MYPATH)\..\Bin
```

Simple registry entries may be accessed via `%(HKLM\Path\Key)` or `%(HKCU\Path\Key)`, where `HKLM` accesses `HKEY_LOCAL_MACHINE`
and `HKCU` accesses `HKEY_CURRENT_USER`. Only string values may be retrieved.
```
MYPATH=%(HKLM\Software\MySoftware\Path)
```

An environment variable may be applied to a specific Solution Configuration. The syntax for this is `ConfigurationName:Name=Value`.
```
Debug:PATH=$(PATH);%(HKLM\Software\MySoftware\DebugPath)
Release:PATH=$(PATH);%(HKLM\Software\MySoftware\DebugPath)
```

Other .slnenv files may be included using the `include` or `forceinclude` keywords. The filename following each keyword should not contain the .slnenv extension.
```
include $(HOMEDRIVE)$(HOMEPATH)\MyPersonalDefinitions<br>
forceinclude ..\..\MandatoryDefinitions
```

Comments are specified by using -- at the beginning of the line.
```
-- This is a comment.
```

## Acknowledgments

This extension is based on Joshua Jensen's [Auto Build Environment Add-in for Visual Studio .NET](https://www.codeproject.com/Articles/3218/Auto-Build-Environment-Add-in-for-Visual-Studio-NE)
4 changes: 2 additions & 2 deletions source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="SolutionEnvironment.fd3183b7-b5b5-4df3-bc82-594fb5c9375e" Version="1.02.001" Language="en-US" Publisher="Loghorn" />
<Identity Id="SolutionEnvironment.fd3183b7-b5b5-4df3-bc82-594fb5c9375e" Version="1.02.002" Language="en-US" Publisher="Loghorn" />
<DisplayName>Solution Environment</DisplayName>
<Description xml:space="preserve">Provides support for customized global environment settings on a per solution basis</Description>
<MoreInfo>https://github.com/Loghorn/SolutionEnvironment</MoreInfo>
<License>LICENSE</License>
<Tags>Solution, Envisonment, Path</Tags>
<Tags>Solution, Environment, Path</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[16.0, 17.0)" />
Expand Down

0 comments on commit 3a9f2f2

Please sign in to comment.