private void ValidateEntryPointPath(string serviceManifestFileName, FileLocator fileLocator, string program, bool isExternalExecutable = false) { string entryPointPath = this.GetEntryPointPath(program, serviceManifestFileName); if (string.IsNullOrEmpty(entryPointPath)) { ImageBuilderUtility.TraceAndThrowValidationErrorWithFileName( TraceType, serviceManifestFileName, StringResources.ImageBuilderError_NullOrEmptyError, "EntryPoint"); } else if (entryPointPath.IndexOfAny(System.IO.Path.GetInvalidPathChars()) != -1) { ImageBuilderUtility.TraceAndThrowValidationErrorWithFileName( TraceType, serviceManifestFileName, StringResources.ImageBuilderError_InvalidValue, "EntryPoint", entryPointPath); } else if (System.IO.Path.IsPathRooted(entryPointPath)) { ImageBuilderUtility.TraceAndThrowValidationErrorWithFileName( TraceType, serviceManifestFileName, StringResources.ImageBuilderError_RootedEntryPointNotSupported, entryPointPath); } if (isExternalExecutable) { ImageBuilder.TraceSource.WriteInfo( TraceType, "EntryPointPath {0} is external executable", entryPointPath); } else if (!fileLocator.FileExists(entryPointPath)) { #if !DotNetCoreClrLinux if (string.IsNullOrEmpty(Path.GetExtension(entryPointPath)) && fileLocator.FileExists(entryPointPath + ".exe")) { return; } #endif ImageBuilderUtility.TraceAndThrowValidationErrorWithFileName( TraceType, serviceManifestFileName, StringResources.ImageBuilderError_EntryPointNotFound, entryPointPath); } }