Updated to net7, updated deps, added '### YamlMime:ManagedReference'

master v3.2
Vitalii Mikhailov 2 years ago
parent 9f004dd190
commit f88f82fe3a
No known key found for this signature in database
GPG Key ID: 954DDABC3A87570A

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>LastModifiedPostProcessor</AssemblyName>
<RootNamespace>DocFx.Plugin.LastModified</RootNamespace>
<Version>1.2.4</Version>
@ -18,11 +18,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="htmlagilitypack" Version="1.4.9" />
<PackageReference Include="libgit2sharp" Version="0.27.0-preview-0096" />
<PackageReference Include="htmlagilitypack" Version="1.11.46" />
<PackageReference Include="libgit2sharp" Version="0.27.2" />
<PackageReference Include="Microsoft.Composition" Version="1.0.31" />
<PackageReference Include="Microsoft.DocAsCode.Common" Version="2.57.2" />
<PackageReference Include="Microsoft.DocAsCode.Plugins" Version="2.57.2" />
<PackageReference Include="Microsoft.DocAsCode.Common" Version="2.66.1" />
<PackageReference Include="Microsoft.DocAsCode.Plugins" Version="2.66.1" />
</ItemGroup>
</Project>

@ -30,7 +30,7 @@ namespace DocFx.Plugin.LastModified
var versionInfo = Assembly.GetExecutingAssembly()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
?.InformationalVersion ??
Assembly.GetExecutingAssembly().GetName().Version.ToString();
Assembly.GetExecutingAssembly().GetName().Version?.ToString();
Logger.LogInfo($"Version: {versionInfo}");
Logger.LogInfo("Begin adding last modified date to items...");

@ -32,6 +32,8 @@ namespace SandcastleXrefGenerator
var serializer = new SerializerBuilder().Build();
var file = new FileInfo(args[4]);
file.Directory!.Create();
await using var stream = file.CreateText();
await stream.WriteLineAsync("### YamlMime:ManagedReference");
serializer.Serialize(file.CreateText(), map);
return 0;
}
@ -50,22 +52,21 @@ namespace SandcastleXrefGenerator
foreach (var entry in zip.Entries)
{
// We assume there's just one assembly, for simplicity.
if (entry.Key.StartsWith(prefix) && entry.Key.EndsWith(".dll"))
{
using var stream = entry.OpenEntryStream();
// Mono.Cecil requires the stream to be seekable. It's simplest
// just to copy the whole DLL to a MemoryStream and pass that to Cecil.
var ms = new MemoryStream();
stream.CopyTo(ms);
ms.Position = 0;
return ModuleDefinition.ReadModule(ms);
}
if (!entry.Key.StartsWith(prefix) || !entry.Key.EndsWith(".dll")) continue;
using var stream = entry.OpenEntryStream();
// Mono.Cecil requires the stream to be seekable. It's simplest
// just to copy the whole DLL to a MemoryStream and pass that to Cecil.
var ms = new MemoryStream();
stream.CopyTo(ms);
ms.Position = 0;
return ModuleDefinition.ReadModule(ms);
}
throw new Exception($"No file found in package starting with '{prefix}'");
}
private static XRefMap BuildXRefMap(ModuleDefinition module, string baseUrl) => new XRefMap
private static XRefMap BuildXRefMap(ModuleDefinition module, string baseUrl) => new()
{
BaseUrl = baseUrl,
References = module.Types
@ -77,9 +78,8 @@ namespace SandcastleXrefGenerator
private static XRefSpec CreateXRefSpec(TypeDefinition type)
{
if (!type.IsPublic)
{
return null;
}
return new XRefSpec
{
Name = type.Name, // TODO: Get the name with <T> etc in

@ -0,0 +1,12 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"SandcastleXrefGenerator": {
"commandName": "Project",
"commandLineArgs": "Newtonsoft.Json 13.0.1 netstandard2.0 https://www.newtonsoft.com/json/help/html/ xrefs/Newtonsoft.Json-xrefmap.yml",
"environmentVariables": {
}
}
}
}

@ -2,23 +2,21 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net472</TargetFramework>
<langversion>8.0</langversion>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>11.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<!-- It's this dependency that forces us to use the full framework. Replace when we can... -->
<PackageReference Include="Microsoft.DocAsCode.Build.Engine" Version="2.41.0" />
<PackageReference Include="Mono.Cecil" Version="0.10.0-beta5" />
<PackageReference Include="MoreLinq" Version="2.3.0" />
<PackageReference Include="SharpCompress" Version="0.29.0" />
<PackageReference Include="YamlDotNet" Version="6.0.0" />
<PackageReference Include="Microsoft.DocAsCode.Build.Engine" Version="2.66.1" />
<PackageReference Include="Mono.Cecil" Version="0.11.5" />
<PackageReference Include="MoreLinq" Version="3.4.2" />
<PackageReference Include="SharpCompress" Version="0.33.0" />
<PackageReference Include="YamlDotNet" Version="13.1.0" />
<Reference Include="System.Net.Http" />
<!-- Make sure we can build on non-Windows, even though we can't run. -->
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies"
Version="1.0.0-preview.1"
PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
</ItemGroup>
</Project>
Loading…
Cancel
Save