Missing property? Or a Blonde moment?

  • Thread starter Thread starter 4Space
  • Start date Start date
4

4Space

I'm trying to write a plugin for visual studio, but I've hit a snag with a
property that should be there, but kind of isn't.

private bool IsProjectThemed( EnvDTE.Project project )
{
try
{
if ( project.Globals.get_VariableExists( m_themedFlagName ) )
{
return ( project.Globals.VariableValue( m_themedFlagName ) ==
true );
}
else
{
return false;
}
}
catch ( Exception )
{
return false;
}
}


But apparently...

'EnvDTE.Globals' does not contain a definition for 'VariableValue'

But according to MSDN, it should be there. Any suggestions?


Cheers,

4Space
 
This is off the cuff - but
if I remember correctly -

EnvDTE has a dte property that has the variableValue in it.

or you has to delare the EnvDTE dte and use it like that

you are correct I pulled my hiar out looking for it also
 
Hi,

Thanks for your post. The reason why you did not find the VariableValue
property of Globals is that VariableValue is the default member attribute
of Globals and it is shown as the following definition in the Object
Browser:

public const abstract new object this [ get, set ]
Member of EnvDTE.Globals

So we are able to access the VariableValue with the code as shown below:
project.Globals[m_themedFlagName]

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top