2
Vote

Scaffold doesn't work with VCS Express

description

I have Visual C# 2008 Express Edition installed, and scaffold gives "error: A supported version of Visual Studio is not installed".

comments

k_kazu wrote Aug 21, 2008 at 2:54 AM

please change Microsoft.Tools.CodeRunner/scaffold.cs file GetVisualStudioInfo() function ( line 249 )

private VisualStudioInfo GetVisualStudioInfo()
{
string exeName = null;
string[] vsRegistryRoots = 
{
    @"SOFTWARE\Microsoft\VisualStudio\9.0",
    @"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0",
    @"SOFTWARE\Microsoft\VisualStudio\8.0",
    @"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\8.0",
    @"SOFTWARE\Microsoft\VCSExpress\9.0",
    @"SOFTWARE\Microsoft\VCSExpress\8.0",
};

RegistryKey rk = null;

for (int i = 0; i < vsRegistryRoots.Length; ++i)
{
    rk = Registry.LocalMachine.OpenSubKey(vsRegistryRoots[i]);

    if (rk != null)
    {
        // We have a key, but do we have the Installdir value?  If
        // the actual 32-bit VS registry keys will be under Wow643
        try
        {
            object obj = rk.GetValue("InstallDir");

            if (obj != null)
            {
                exeName = obj.ToString();
                string exePath = exeName + (exeName.EndsWith(@"\")
                if (System.IO.File.Exists(exePath))
                {
                    exeName = exePath;
                    break;
                }
                else
                {
                    exePath = exeName + (exeName.EndsWith(@"\") ? 
                    if (System.IO.File.Exists(exePath))
                    {
                        exeName = exePath;
                        break;
                    }
                }
                break;
            }
        }
        catch (Exception e)
        {
            if (!(e is SecurityException ||
                e is UnauthorizedAccessException ||
                e is IOException))
            {
                throw e;
            }
        }
    }
}

if (exeName == null)
{
    Output.Error(ScaffoldResources.VSNotInstalled);
    return null;
}

return new VisualStudioInfo(exeName);
}

Is it correct?

wrote Feb 13, 2013 at 12:17 AM