/// <summary>Runs on the specified assembly to document the code in markdown files.</summary> /// <param name="assemblyToCodeDoc">The assembly to code document.</param> /// <param name="outputPath">The output path.</param> /// <exception cref="IOException">No CodeDoc output path found for the assembly: {assemblyToCodeDoc.FullName}.</exception> /// <code><![CDATA[MarkdownCodeDocGenerator.Run(Assembly.GetAssembly(typeof(OneTypeFromTheAssemblyToDocument)));]]></code> /// <example><![CDATA[MarkdownCodeDocGenerator.Run(Assembly.GetAssembly(typeof(LocalizedDescriptionAttribute)));]]></example> public static void Run(Assembly assemblyToCodeDoc, DirectoryInfo?outputPath = null) { var typeComments = AssemblyCommentHelper.CollectExportedTypesWithComments(assemblyToCodeDoc); if (!typeComments.Any()) { return; } outputPath ??= GetOutputPath(assemblyToCodeDoc); if (outputPath == null) { throw new IOException($"No CodeDoc output path found for the assembly: {assemblyToCodeDoc.FullName}"); } PrepareOutputPath(outputPath); GenerateAndWrites(typeComments, outputPath); }
/// <summary>Runs on the specified assembly to document the code in markdown files.</summary> /// <param name="assemblyToCodeDoc">The assembly to code document.</param> /// <param name="outputPath">The output path.</param> /// <exception cref="IOException">No CodeDoc output path found for the assembly: {assemblyToCodeDoc.FullName}.</exception> /// <code><![CDATA[MarkdownCodeDocGenerator.Run(Assembly.GetAssembly(typeof(OneTypeFromTheAssemblyToDocument)));]]></code> /// <example><![CDATA[MarkdownCodeDocGenerator.Run(Assembly.GetAssembly(typeof(LocalizedDescriptionAttribute)));]]></example> public static void Run(Assembly assemblyToCodeDoc, DirectoryInfo?outputPath = null) { // Due to some build issue with GenerateDocumentationFile=true and xml-file location, this hack is made for now. if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return; } var typeComments = AssemblyCommentHelper.CollectExportedTypesWithComments(assemblyToCodeDoc); if (!typeComments.Any()) { return; } outputPath ??= GetOutputPath(assemblyToCodeDoc); if (outputPath == null) { throw new IOException($"No CodeDoc output path found for the assembly: {assemblyToCodeDoc.FullName}"); } PrepareOutputPath(outputPath); GenerateAndWrites(typeComments, outputPath); }