/// <summary>
/// Constructor to create a new MSBuild.ProjectItem and add it to the project
/// Only have internal constructors as the only one who should be creating
/// such object is the project itself (see Project.CreateFileNode()).
/// </summary>
internal ProjectElement(ProjectNode project, string itemPath, string itemType)
{
if (project == null)
{
throw new ArgumentNullException("project");
}
if (string.IsNullOrEmpty(itemPath))
{
throw new ArgumentException(
SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemPath");
}
if (string.IsNullOrEmpty(itemType))
{
throw new ArgumentException(
SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "itemType");
}
itemProject = project;
// create and add the item to the project
Item = project.BuildProject.AddItem(itemType, MSBuild.ProjectCollection.Escape(itemPath))[0];
itemProject.SetProjectFileDirty(true);
RefreshProperties();
}