internal void RemoveAllCodegenFiles()
        {
            this.RemoveCodegenResourceDir();
            foreach (FileData data in (IEnumerable)FileEnumerator.Create(base._cacheDir))
            {
                if (data.IsDirectory)
                {
                    if (((data.Name != "assembly") && (data.Name != "hash")) && !StringUtil.StringStartsWith(data.Name, "Sources_"))
                    {
                        try
                        {
                            this.DeleteFilesInDirectory(data.FullName);
                        }
                        catch
                        {
                        }
                    }
                }
                else
                {
                    DiskBuildResultCache.TryDeleteFile(data.FullName);
                }
            }
            AppDomainSetup setupInformation = Thread.GetDomain().SetupInformation;

            UnsafeNativeMethods.DeleteShadowCache(setupInformation.CachePath, setupInformation.ApplicationName);
        }
Exemple #2
0
        internal void RemoveAllCodegenFiles()
        {
            Debug.Trace("BuildResultCache", "Deleting all files from " + _cacheDir);

            RemoveCodegenResourceDir();

            // Remove everything in the codegen directory, as well as all the subdirectories
            // used for culture assemblies

            // Go through all the files in the codegen dir.  Delete everything, except
            // for the fusion cache, which is in the "assembly" subdirectory
            foreach (FileData fileData in FileEnumerator.Create(_cacheDir))
            {
                // If it's a directories
                if (fileData.IsDirectory)
                {
                    // Skip the fusion cache
                    if (fileData.Name == fusionCacheDirectoryName)
                    {
                        continue;
                    }

                    // Skip the "hash" folder
                    if (fileData.Name == webHashDirectoryName)
                    {
                        continue;
                    }

                    // Skip the source files generated for the designer (VSWhidbey 138194)
                    if (StringUtil.StringStartsWith(fileData.Name, CodeDirectoryCompiler.sourcesDirectoryPrefix))
                    {
                        continue;
                    }

                    try {
                        // If it is a directory, only remove the files inside and not the directory itself
                        // VSWhidbey 596757
                        DeleteFilesInDirectory(fileData.FullName);
                    }
                    catch { } // Ignore all exceptions

                    continue;
                }

                // VSWhidbey 564168 Do not delete files that cannot be deleted, these files are still
                // referenced by other appdomains that are in the process of shutting down.
                // We also do not rename as renaming can cause an assembly not to be found if another
                // appdomain tries to compile against it.
                DiskBuildResultCache.TryDeleteFile(fileData.FullName);
            }


            // Clean up the fusion shadow copy cache

            AppDomainSetup appDomainSetup = Thread.GetDomain().SetupInformation;

            UnsafeNativeMethods.DeleteShadowCache(appDomainSetup.CachePath,
                                                  appDomainSetup.ApplicationName);
        }
Exemple #3
0
        private static void RemoveAssembly(string path)
        {
            FileInfo f = new FileInfo(path);

            DiskBuildResultCache.RemoveAssembly(f);
            string str = Path.ChangeExtension(f.FullName, ".pdb");

            if (File.Exists(str))
            {
                DiskBuildResultCache.TryDeleteFile(new FileInfo(str));
            }
        }
Exemple #4
0
        private static void RemoveAssembly(string path)
        {
            var f = new FileInfo(path);

            DiskBuildResultCache.RemoveAssembly(f);
            // Delete the associated pdb file as well, since it is possible to
            // run into a situation where the dependency has changed just
            // when the cache item is about to get inserted, resulting in
            // the callback deleting only the dll file and leaving behind the
            // pdb file. (Dev10 bug 846606)
            var pdbPath = Path.ChangeExtension(f.FullName, ".pdb");

            if (File.Exists(pdbPath))
            {
                DiskBuildResultCache.TryDeleteFile(new FileInfo(pdbPath));
            }
        }
 private void InvalidateInvalidAssembly(CompilerResults results, CompilerParameters compilParams)
 {
     if ((results != null) && results.Errors.HasErrors)
     {
         foreach (CompilerError error in results.Errors)
         {
             if (!error.IsWarning && System.Web.Util.StringUtil.EqualsIgnoreCase(error.ErrorNumber, "CS0016"))
             {
                 if (this.CultureName != null)
                 {
                     DiskBuildResultCache.TryDeleteFile(new FileInfo(Path.Combine(this._tempFiles.TempDir, this.OutputAssemblyName + ".dll")));
                 }
                 DiskBuildResultCache.TryDeleteFile(compilParams.OutputAssembly);
             }
         }
     }
 }