internal override string ComputeSourceDependenciesHashCode(VirtualPath virtualPath) { if (virtualPath == null) { virtualPath = base.VirtualPath; } HashCodeCombiner combiner = new HashCodeCombiner(); combiner.AddResourcesDirectory(virtualPath.MapPathInternal()); return combiner.CombinedHashString; }
/* * Check if the top level files are up to date, and cleanup the codegendir * if they are not. */ private long CheckTopLevelFilesUpToDateInternal(long cachedHash) { Debug.Trace("BuildManager", "specialFilesCombinedHash=" + cachedHash); var specialFilesHashCodeCombiner = new HashCodeCombiner(); // Delete all the non essential files left over in the codegen dir, unless // specialFilesCombinedHash is 0, in which case we delete *everything* further down if (cachedHash != 0) { _codeGenCache.RemoveOldTempFiles(); } // Use a HashCodeCombiner object to handle the time stamps of all the 'special' // files and directories that all compilations depend on: // - System.Web.dll (in case there is a newer version of ASP.NET) // - ~\Bin directory // - ~\Resource directory // - ~\WebReferences directory // - ~\Code directory // - global.asax // Add a check for the app's physical path, in case it changes (ASURT 12975) specialFilesHashCodeCombiner.AddObject(HttpRuntime.AppDomainAppPathInternal); // Process System.Web.dll string aspBinaryFileName = typeof(HttpRuntime).Module.FullyQualifiedName; if (!AppSettings.PortableCompilationOutput) { specialFilesHashCodeCombiner.AddFile(aspBinaryFileName); } else { specialFilesHashCodeCombiner.AddExistingFileVersion(aspBinaryFileName); } // Process machine.config string machineConfigFileName = HttpConfigurationSystem.MachineConfigurationFilePath; if (!AppSettings.PortableCompilationOutput) { specialFilesHashCodeCombiner.AddFile(machineConfigFileName); } else { specialFilesHashCodeCombiner.AddFileContentHash(machineConfigFileName); } // Process root web.config string rootWebConfigFileName = HttpConfigurationSystem.RootWebConfigurationFilePath; if (!AppSettings.PortableCompilationOutput) { specialFilesHashCodeCombiner.AddFile(rootWebConfigFileName); } else { specialFilesHashCodeCombiner.AddFileContentHash(rootWebConfigFileName); } RuntimeConfig appConfig = RuntimeConfig.GetAppConfig(); CompilationSection compConfig = appConfig.Compilation; // Ignore the OptimizeCompilations flag in ClientBuildManager mode if (!BuildManagerHost.InClientBuildManager) { _optimizeCompilations = compConfig.OptimizeCompilations; } // In optimized compilation mode, we don't clean out all the compilations just because a top level // file changes. Instead, we let already compiled pages run against the newer top level binaries. // In can be incorrect in some cases (e.g. return type of method changes from int to short), which is // why the optimization is optional if (!OptimizeCompilations) { // Add a dependency of the bin, resources, webresources and code directories string binPhysicalDir = HttpRuntime.BinDirectoryInternal; specialFilesHashCodeCombiner.AddDirectory(binPhysicalDir); // Note that we call AddResourcesDirectory instead of AddDirectory, since we only want // culture neutral files to be taken into account (VSWhidbey 359029) specialFilesHashCodeCombiner.AddResourcesDirectory(HttpRuntime.ResourcesDirectoryVirtualPath.MapPathInternal()); specialFilesHashCodeCombiner.AddDirectory(HttpRuntime.WebRefDirectoryVirtualPath.MapPathInternal()); specialFilesHashCodeCombiner.AddDirectory(HttpRuntime.CodeDirectoryVirtualPath.MapPathInternal()); // Add a dependency on the global asax file. specialFilesHashCodeCombiner.AddFile(GlobalAsaxVirtualPath.MapPathInternal()); } // Add a dependency on the hash of the app level <compilation> section, since it // affects all compilations, including the code directory. It it changes, // we may as well, start all over. specialFilesHashCodeCombiner.AddObject(compConfig.RecompilationHash); ProfileSection profileSection = appConfig.Profile; specialFilesHashCodeCombiner.AddObject(profileSection.RecompilationHash); // Add a dependency on file encoding (DevDiv 4560) specialFilesHashCodeCombiner.AddObject(appConfig.Globalization.FileEncoding); // Also add a dependency on the <trust> config section TrustSection casConfig = appConfig.Trust; specialFilesHashCodeCombiner.AddObject(casConfig.Level); specialFilesHashCodeCombiner.AddObject(casConfig.OriginUrl); // Add a dependency on whether profile is enabled specialFilesHashCodeCombiner.AddObject(ProfileManager.Enabled); // Add a dependency to the force debug flag. specialFilesHashCodeCombiner.AddObject(PrecompilingWithDebugInfo); CheckCodeGenFiles(specialFilesHashCodeCombiner.CombinedHash, cachedHash); return specialFilesHashCodeCombiner.CombinedHash; }
internal override string ComputeSourceDependenciesHashCode(VirtualPath virtualPath) { // If no virtual path was passed in, use the one from the BuildResult if (virtualPath == null) virtualPath = VirtualPath; // We don't want to use the default ComputeSourceDependenciesHashCode imnplementation, // as it would use all files in the resources dir to calculate the hash. Instead, // we only want the hash the be based on the culture neutral resources, so that // changes to culture specific files don't cause a rebuild of the main res assembly HashCodeCombiner hashCodeCombiner = new HashCodeCombiner(); hashCodeCombiner.AddResourcesDirectory(virtualPath.MapPathInternal()); return hashCodeCombiner.CombinedHashString; }