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

1.8k Views Asked by At

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.

1

There are 1 best solutions below

0
On

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: