I've programatically created a number of files. I want to add them to the visual studio project. I have a reference to the project (DTE.Project). When I execute the code below, I get an error message.
project.ProjectItems.AddFromFile(filename);
The error is
Exception at 'Expand' - 'Unable to add 'manage.txt'. A file with that name already exists.'
System.Runtime.InteropServices.COMException (0x80040400): Unable to add 'manage.txt'. A file with that name already exists.
at EnvDTE.ProjectItems.AddFromFile(String FileName)
When I wrap the call in a try-catch, the process runs to completion but non of the files are added to the project. I have to manually show hidden files and then include them in the project.
How do I add the file for this to work?