Hi. I want to write an addin command that adds a file to a project. The code I tried didn't work:
IProject p = ProjectService.CurrentProject;
ProjectItem pi = new FileProjectItem(p, ItemType.Content);
pi.Include = filename;
pi.FileName = filename;
p.Items.Add(pi);
p.IsDirty = true
where "filename" is the filename with no path (or relative path, for that manner).
I also tried some variations of that code, but nothing worked.
Can someone please direct me to the correct way of doing this?
Thanks, Itai.