Problem using EnvDTE.Property.set_Value to set ProjectItem FullPath Property

2

I have a Visual Studio Project Wizard that attempts to configure a VC# project to override the FullPath property for selected files from the template.

The following code is used from within function

public void ProjectFinishedGenerating(Project project)

string path = "some file name";
project.ProjectItems.Item("some file").Properties.Item("FullPath").Value = path;

System.Reflection.TargetParameterCountException: Invalid number of parameters. (Exception from HRESULT: 0x8002000E (DISP_E_BADPARAMCOUNT)) at EnvDTE.Property.set_Value(Object lppvReturn)

I know that I have a valid ProjectItem object because I can display the original value.

properties
envdte
projectitem
asked on Stack Overflow Dec 3, 2010 by user517041

1 Answer

1

I think the problem is that the FullPath property is read-only. You can figure this out by looking at the definition in MSDN - http://msdn.microsoft.com/en-us/library/vslangproj.fileproperties.fullpath.aspx - it only has a getter defined.

To call set_Value, you need be updating a property that has a public setter. According to the properties documented on the FileProperties interface, the only settable properties are:

answered on Stack Overflow Jan 18, 2012 by David Gardiner

User contributions licensed under CC BY-SA 3.0