Is it possible to determine Visual Studio edition during c# compile time

To use MS Fakes shims, I had to conditionally exclude related tests  to allow easily bypass them on Community and Professional Editions of the Visual Studio.
#if !FAKES_NOT_SUPPORTED
[ TestMethod()]
Fakes related code
#endif
I tried to find does edition automatically pre-defined by compiler, but it’s not included in Conditional Compilation Constants

Furthermore,  these constants seems defined in VB only, and not in c# and not updated since VS2008.

The reasons are discussed in “Pre-defined Constants, preprocessor directives, etc… “

The “C# Language Designers” decided to not include constants in the fashion in which C/C++ allows them.  To allow some, or even one, would open a Pandora’s Box of voices suggesting new constants to be added.

But I disagree,  because if the limitation coming from VS , it should provide a way to  determine it in pre-condition.
The related article shows how to check installed Visual Studio on run-time
Unfortunately I didn’t find, is it possible to determine Visual Studio edition  during c# compile time?

#compile-time, #constants, #visual-studio

Visual Studio 15 build Task could not find “sgen.exe”

On new Windows 10 machine with Visual Studio 2015 installed when I tried to build my solution from batch file, I’ve got an error

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(2769,5): error MSB3086: Task could not find “s
gen.exe” using the SdkToolsPath “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\” or the regis
try key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0A\WinSDK-NetFx40Tools-x86”. Make sure the Sdk
ToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Mic
rosoft Windows SDK is installed

http://stackoverflow.com/questions/2731365/running-msbuild-fails-to-read-sdktoolspath
suggested to Install Microsoft Windows SDK for Windows 7 and .NET Framework AKA v7.1.

But I’ve got error: Windows SDK Setup
Some Windows SDK components require the RTM .NET Framework 4. Setup detected a pre-release version of the .NET Framework 4. If you continue with Setup, these components will not be installed. If you want to install these components, click Cancel, then install the .NET Framework 4 from http://go.microsoft.com/fwlink/?LinkID=187668 and then rerun Setup.
The message is misleading, because I have .net framework 4.6, but I Tried to install the .NET Framework 4 from https://www.microsoft.com/en-us/download/details.aspx?id=17851
I’ve got expected message:
Same or higher version of .NET Framework 4 has already been installed on this computer

I’ve tried different suggestions trying to change path and properties in Microsoft.Common.targets, but finally gave up and

Copy sgen.exe, al.exe and al.exe.config from C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\
to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\

as suggested at http://stackoverflow.com/questions/4923131/task-could-not-find-al-exe-using-the-sdktoolspath

#build, #visual-studio