Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

The Visual Studio Extension doesn't work #311

Closed
Starless2001 opened this issue Mar 25, 2014 · 3 comments
Closed

The Visual Studio Extension doesn't work #311

Starless2001 opened this issue Mar 25, 2014 · 3 comments

Comments

@Starless2001
Copy link

I've installed SharpDX Toolkit for VisualStudio. I use Visual Studio Ultimate 2012. I have SharpDX installed correctly (got this file SharpDX-Full-2.5.0.exe from here: http://www.sharpdx.com/download/). I get this error when I try to create a solution:

SharpDX Toolkit Wizard Error
Unable to find SharpDX installation directory. Expecting [SharpDXSdkDir] environment variable

The variable is set. The installer set it as a user variable with the correct installation path: C:\Program Files (x86)\SharpDX\ I tryed to set it as a system variable too, same name, same value, same error.

@xoofx
Copy link
Member

xoofx commented Mar 25, 2014

Weird, the code that is showing this message box is doing this:

if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("SharpDXSdkDir")))
{
    MessageBox.Show("Unable to find SharpDX installation directory. Expecting [SharpDXSdkDir] environment variable", "SharpDX Toolkit Wizard Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    throw new WizardCancelledException("Expecting [SharpDXSdkDir] environment variable");
}

So it means that Environment.GetEnvironmentVariable("SharpDXSdkDir") is null or empty. Could you try set in a command line and find if SharpDXSdkDir correctly show up? Could you also write a simple .NET program and run it on your machine to check this env variable?

@Starless2001
Copy link
Author

Thanks a lot for your help, I did as you instructed.

set works perfectly, and prints what it should: the installation directory of SharpDX.

This line does not work:

Console.WriteLine("SharpDXSdkDir = " + Environment.GetEnvironmentVariable("SharpDXSdkDir"));

That's the overload the Visual Studio Extension invokes. It doesn't print the path to the installation folder, just an empty string where it should be..

This line works:

Console.WriteLine("SharpDXSdkDir = " + Environment.GetEnvironmentVariable("SharpDXSdkDir",
 EnvironmentVariableTarget.User));

The installer sets SharpDXSdkDir for me as an environment variable at user level. For the Visual Studio extension to work as the installer is now, the Visual Studio extension should use this overload with this EnvironmentVariableTarget value, but I'm not sure if SharpDX would work for all users then. I have a better suggestion bellow

This line also works in my case

Console.WriteLine("SharpDXSdkDir = " + Environment.GetEnvironmentVariable("SharpDXSdkDir",
 EnvironmentVariableTarget.Machine));

Probably because I have manually set the SharpDXSdkDir variable as a system variable, while attempting to solve the problem. I think the best idea would be if the installer would set SharpDXSdkDir as a system environment variable instead of a user variable, and I think the Visual Studio Extension should invoke this overload passing EnvironmentVariableTarget.Machine as the second argument

This call, on the other hand does not work:

Console.WriteLine("SharpDXSdkDir = " + Environment.GetEnvironmentVariable("SharpDXSdkDir",
 EnvironmentVariableTarget.Process));

I think this is the equivalent of the overload of Environment.GetEnvironmentVariable that receives only a string argument, and behaves exactly like it: prints an empty string where the value of the variable should be

xoofx added a commit that referenced this issue Mar 25, 2014
@xoofx
Copy link
Member

xoofx commented Mar 25, 2014

Super, thanks for investigating this! This is fixed by commit 005d95c. Hopefully available in next release 2.6

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants