error CS0246: The type or namespace name 'WixSharp' could not be found

May 7, 2015 at 9:32 AM
I execute the Wix# script like cscs Script.cs (Script.cs is C# file)
from command line and get the error:
error CS0246: The type or namespace name 'WixSharp' could not be found (are you missing a using directive or an assembly reference?)

WixSharp binary is installed at the c:\lib\WixSharp and environment variables are set

I try both ordinary Windows command prompt and Developer Command Prompt for VS2013. Same error.
WixSharp NuGet package is installed and assembly is referenced in the project.

Any suggestions what is wrong with my WixSharp setup?
May 7, 2015 at 9:57 AM
The solution will be in the script.cs file. Most likely the script is missing the reference to the wixsharp.dll. If you are executing the script from VS then the assembly is referenced explicitly in the VS project file. But you are executing it with CS-Script so you need to let the script engine know where to probe for wixsharp.dll. There various ways of doing this. Add to your script (above usings):
//css_ref %WIXSHARP_DIR%\wixsharp.dll;


//css_dir %WIXSHARP_DIR%; 
using WixSharp; 
Some additional reading:
May 7, 2015 at 11:17 AM
//css_ref %WIXSHARP_DIR%\wixsharp.dll;
This works fine!
Thank you.