CheckGenerateFileIsValid(IVsProject project, string path)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var projectDir = project.GetProjectBaseDirectory();
            var dteproject = project.GetDTEProject();

            if (project.IsCSharpProject())
            {
                var fileset = GetCsharpGeneratedFiles(project, dteproject, projectDir, path);
                foreach (var source in fileset.sources.Keys)
                {
                    if (File.Exists(source))
                    {
                        const string message =
                            "A file named '{0}' already exists. If you want to add '{1}' first remove '{0}'.";

                        UIUtil.ShowErrorDialog("Ice Builder",
                                               string.Format(message,
                                                             FileUtil.RelativePath(projectDir, source),
                                                             FileUtil.RelativePath(projectDir, path)));
                        return(false);
                    }
                }
            }
            else
            {
                var fileset = GetCppGeneratedFiles(project, dteproject, ProjectFactoryHelperInstance.VCUtil, projectDir, path);

                foreach (var source in fileset.sources.Keys)
                {
                    if (File.Exists(source))
                    {
                        const string message =
                            "A file named '{0}' already exists. If you want to add '{1}' first remove '{0}' .";

                        UIUtil.ShowErrorDialog("Ice Builder",
                                               string.Format(message,
                                                             FileUtil.RelativePath(projectDir, source),
                                                             FileUtil.RelativePath(projectDir, path)));
                        return(false);
                    }
                }

                foreach (var header in fileset.headers.Keys)
                {
                    if (File.Exists(header))
                    {
                        const string message =
                            "A file named '{0}' already exists. If you want to add '{1}' first remove '{0}' .";

                        UIUtil.ShowErrorDialog("Ice Builder",
                                               string.Format(message,
                                                             FileUtil.RelativePath(projectDir, header),
                                                             FileUtil.RelativePath(projectDir, path)));
                        return(false);
                    }
                }
            }
            return(true);
        }
 //
 // Check if IceBuilder 4.x is enabled
 //
 public static IceBuilderProjectType IsIceBuilderEnabled(IVsProject project)
 {
     if (project != null)
     {
         IceBuilderProjectType type = project.IsCppProject() ? IceBuilderProjectType.CppProjectType :
                                      project.IsCSharpProject() ? IceBuilderProjectType.CsharpProjectType : IceBuilderProjectType.None;
         if (type != IceBuilderProjectType.None)
         {
             return(project.WithProject((MSProject msproject) =>
             {
                 if (MSBuildUtils.IsIceBuilderEnabled(msproject))
                 {
                     return type;
                 }
                 return IceBuilderProjectType.None;
             }));
         }
     }
     return(IceBuilderProjectType.None);
 }