Example #1
0
 /// <summary>
 /// Initializes the VS Helper
 /// </summary>
 /// <param name="serviceProvider">The service provider to use</param>
 public static void Initialize(IServiceProvider serviceProvider)
 {
     if (Current == null)
     {
         Current = new VsHelper(serviceProvider);
     }
 }
        /// <summary>
        /// Gets whether a config file exists for the solution and it added to the project
        /// </summary>
        /// <returns>True if it exists and is added</returns>
        public static bool ConfigExistsForProject(Project proj)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            string configPath = ScriptGenAssemblyCache.GetForProj(proj)?.GetConfigFilepath(proj.FullName);

            if (string.IsNullOrEmpty(configPath))
            {
                return(false);
            }
            bool configExists = File.Exists(configPath);

            bool existsButNotAdded = (configExists && !VsHelper.SolutionItemExists(configPath));

            return(configExists && !existsButNotAdded);
        }