envdte

How do I find and open a file in a Visual Studio 2005 add-in?

I'm making an add-in with Visual Studio 2005 C# to help easily toggle between source and header files, as well as script files that all follow a similar naming structure. However, the directory structure has all of the files in different places, even though they are all in the same project. I've got almost all the pieces in place, but...

How to add reference to EnvDTE project?

Hello, I have the project getting using DTE with C++: pSolution->get_Projects(&pProjects); CComPtr<EnvDTE::Project> pProject; pProjects->get_Items(1, &pProject); Then I need to add reference to this project. How to do that? As far as I know VsLangProj namespace is not accessible for C++ code. Thanks ...

EnvDTE Retrieving the data type from a CodeElement

I am using EnvDTE to generate some code in my latest project. I have a reference to a CodeClass-Object for a given C#-Class but now I wanted to loop through all of its members (in codeClass.Members) and check their types. However I can't manage to retrieve the type of the given member from the CodeElement-Object that I get when looping...

How to block on a OpenFile in a Visual Studio addin

I have a Visual Studio 2008 addin that when I press a certain hotkey, it opens a specific file (different based on the context of the hotkey) and then searches that file for a specific string (again, context dependent.) Most of the time this works flawlessly, but sometimes if the file it's opening is too big, the search will fail. Here ...

Access EnvDTE from msbuild code when building in Visual Studio

When I do a build from Visual Studio, on post-build I execute a PowerShell script from MSBuild using the PowerShell MSBuild Task (http://powershellmsbuild.codeplex.com/). In this PowerShell code I would like to add/modify items to my project using Visual Studio automation (through the EnvDTE object). The exact case is: For each X.asmx ...

IDE crashes while calling ProjectItems.AddFromFile with TFS connected

Hi, i wrote a Visual Studio 2008 Addin, which generates some code files for me with some settings which i can enter on a UI form. If i execute the addin with a connection to our TFS 2008, the dialog of the TFS appears where the progress bar is shown (file is added to tfs source control). The host IDE (where i call the Addin) crashes w...

EnvDTE CodeProperty - TypeName of Arrays is ""

I have the following code to iterate through some properties of my class IEnumerable<CodeProperty> properties = CodeParser.GetEntityProjectItem(this, EntityClassType.Entity).FileCodeModel.GetClassesByName(method.EntityPropertyClassName).First().GetIEnumerable<CodeProperty>().Where(property => property.Getter != null && property.Access =...

How can I get only classes defined in the current project in EnvDTE?

I've got a Package for Vs2010 that currently follows EnvDTE=>Solution=>Projects=>CodeModel=>CodeElements to do the following recursively and find classes var q = elements.Cast<CodeElement>() .Where(x => x is CodeClass || x is CodeNamespace) .Where(x => x.Name.StartsWith("System") == false) .Where(x...

How to get caret position inside the active webforms designer having only the DTE object in VS2008?

I want to know some information about where the caret is int the currently active webforms designer window, but I have only the DTE object of VS2008. Anything that gets close to this might help, but what I need is: know the EditableDesignerRegion that corresponds to the place where the carret is know the position of the carret in the t...

How do I prevent IVsBuildPropertyStorage.SetItemAttribute from escaping special characters?

I am working on a Visual Studio 2010 extension and I want to add an attribute to an MSBuild Item, as follows: <EmbeddedResource Include="SomeFile.xml"> <FooAttribute>%(Filename)%(Extension)</FooAttribute> </EmbeddedResource> So, far the only way I found is using the method IVsBuildPropertyStorage.SetItemAttribute . This works ...