protected virtual bool NeedsCompiling()
{
// return true as soon as we know we need to compile
if (!OutputFile.Exists) {
Log(Level.Verbose, "Output file '{0}' does not exist, recompiling.",
OutputFile.FullName);
return true;
}
string typeLibPath = ExtractTypeLibPath(TypeLib.FullName);
// check if the type library was updated since the interop assembly was generated
string fileName = FileSet.FindMoreRecentLastWriteTime(typeLibPath, OutputFile.LastWriteTime);
if (fileName != null) {
Log(Level.Verbose, "'{0}' has been updated, recompiling.",
fileName);
return true;
}
// check if the reference assemblies were updated since the interop assembly was generated
fileName = FileSet.FindMoreRecentLastWriteTime(References.FileNames, OutputFile.LastWriteTime);
if (fileName != null) {
Log(Level.Verbose, "'{0}' has been updated, recompiling.",
fileName);
return true;
}
// if we made it here then we don't have to reimport the typelib.
return false;
}