How can I add an existing file to a project

I have created a file in the project directory. How do I add it to the project so that it show up in the solution explorer and builds?

0
2 comments

Try this:

using (var cookie = folder.GetSolution().CreateTransactionCookie(DefaultAction.Commit, "Create file", NullProgressIndicator.Instance))
{
  string reason;

  if (!cookie.CanAddFile(folder, location, out reason))
    return null;

  projectFile = cookie.AddFile(folder, location);
}

1

Thanks, that worked great!

0

Please sign in to leave a comment.