src/Misc/EFTools/EntityDesign/VisualStudio/VsUtils.cs
// <summary>
//     Create the file if it does not exist
//     Add the file to the project as a dependent file of the project item.
// </summary>
Create the file if it does not exist
Add the file to the project as a dependent file of the project item.
Create the file if it does not exist Add the file to the project as a dependent file of the project item .
internal static ProjectItem AddChildFile(ProjectItems projItems, string childFilePath)
        {
            if (projItems == null)
            {
                return null;
            }
            ProjectItem childProjItem = null;
            if (!File.Exists(childFilePath))
            {
                CreateEmptyFile(childFilePath, Encoding.UTF8);
            }
            try
            {
                childProjItem = projItems.Item(Path.GetFileName(childFilePath));
            }
            catch (ArgumentException)
            {
            }
            if (null == childProjItem)
            {
                childProjItem = projItems.AddFromFileCopy(childFilePath);
                Debug.Assert(null != childProjItem, "ProjectItems.AddFromFileCopy returned null for child file path " + childFilePath);
            }
            return childProjItem;
        }
internal static ProjectItem AddChildFile ( ProjectItems projItems , string childFilePath ) { if ( projItems == null ) { return null ; } ProjectItem childProjItem = null ; if ( ! File . Exists ( childFilePath ) ) { CreateEmptyFile ( childFilePath , Encoding . UTF8 ) ; } try { childProjItem = projItems . Item ( Path . GetFileName ( childFilePath ) ) ; } catch ( ArgumentException ) { } if ( null == childProjItem ) { childProjItem = projItems . AddFromFileCopy ( childFilePath ) ; Debug . Assert ( null != childProjItem , " " + childFilePath ) ; } return childProjItem ; }
Create the file if it does not exist
Add the file to the project as a dependent file of the project item.
Create the file if it does not exist Add the file to the project as a dependent file of the project item .
// Misc-Files project does not support ProjectItems extensibility // and so in this case, there's nothing we can really do but // bail and return. // do nothing - cannot find child item which is dealt with below // if it's not in the project yet, then add it as a dependent // file to our schema projectItems collection
projItems
ProjectItems
childFilePath
string