In my VSIX (VS Extension), I am reading the config properties' .Value of each of the projects in the currently loaded solution. For a C# (csproj) project:
var configurationManager = project.ConfigurationManager;
if (configurationManager == null) return null;
var configuration = configurationManager.ActiveConfiguration;
if (configuration == null) return null;
var properties = configuration.Properties;
if (properties == null) return null;
foreach (var property in properties.Cast<Property>())
{
// reading property.Name is OK but reading property.Value gives the COMException 'not implemented'
if (property == null) continue;
if (property.Name == "StartWorkingDirectory") workingDir = (string)property.Value;
if (property.Name == "StartAction") startProject = 0 == (int)property.Value;
if (property.Name == "StartProgram") startExtProg = (string)property.Value;
if (property.Name == "StartURL") startBrowser = (string)property.Value;
// etc...
}
For every property, I get the COMException: 'The method or operation is not implemented' when I try to read the .Value property, though .Name is fine. All the searched for properties seem to exist, their .Value just can't be read.
This is a brand new VSIX project created with the VS2022 template that includes Microsoft.VisualStudio.SDK and the Microsoft.VisualStudio.BuildTools in the references.
That seems to include every DTE* reference, stdole, and the other VS COM dlls like VSLangProj* (If I try to add these as project references, it says they're already included in the build process). So, I tried adding all those references via nuget packages, but it had no effect I could see and the error remains.
So I can't find anything on how to read these properties on my C# projects (csproj). They're simple C# 8 Console applications, empty that I just created.
Here are all my VSIX project's references, including the ones pulled in by nuget but probably don't need to be:
envdte
envdte80
envdte90
Microsoft.CSharp
Microsoft.VisualStudio.CommandBars
Microsoft.VisualStudio.SDK
Microsoft.VSSDK.BuildTools
NJsonSchema
PresentationCore
PresentationFramework
stdole
System
VSLangProj
VSLangProj100
VSLangProj110
VSLangProj140
VSLangProj150
VSLangProj80
VSLangProj90
WindowsBase
WindowsFormsIntegration
I'm using VS2022, fully updated as of March 2024.
Any ideas?
EDIT: Source at: https://github.com/cbordeman/switchstartupproject/pull/4