Skip to content

Target framework versions #75

@Aldaviva

Description

@Aldaviva

Current version:

1.4.0

Description

This is a fantastic, useful tool which solves a problem that no one else seems to acknowledge, and I am glad to have recently found it.

I was getting build errors due to runtime version incompatibility. Currently, ExportAnnotations.exe seems to target .NET Framework 4.7.2, .NET 5, and 6. With my default Visual Studio 2022 installation, my installed runtimes are .NET 8 and 9. The build attempts to run the .NET 6 ExportAnnotations binary but fails because there is no .NET 6 runtime installed on my computer (see log below).

Rather than install an out-of-support runtime, I was able to work around this by modifying the runtime configuration for this program to roll forward to newer major runtime versions. With this change, the build succeeds and I am able to see the effects of the annotations in programs that depend on my library.

// ~\.nuget\packages\resharper.exportannotations.task\1.4.0\tools\net6.0\ExportAnnotations.runtimeconfig.json
{
  "runtimeOptions": {
    "tfm": "net6.0",
    "rollForward": "latestMajor", // added
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "6.0.0"
    },
    "configProperties": {
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false
    }
  }
}

Would it be possible to add this roll forward configuration in this project's .csproj itself, so that this workaround is not needed? I think this would be preferable to adding more runtime targets like .NET 8 and 9 to this project, since those will eventually be unsupported, so rolling forward reduces the amount of ongoing maintenance required on this project in the future. I can submit a pull request for this change if you want. Otherwise, if rolling forward isn't desirable, adding newer target frameworks would be helpful too.

Thanks.

Configuration

  • I am building with .NET SDK 9.0.306
  • I have .NET Runtime 8 and 9 installed
  • My library is an SDK-style project that targets .NET Standard 2, .NET 6, and 8
  • It depends on this task using
    <PackageReference Include="ReSharper.ExportAnnotations.Task" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
  • It uses all default settings for this task

Regression?

false

Other information

Failing build log

dotnet build -v:d
MyLibrary net8.0 failed with 1 error(s) (0.4s)
  Running ExportAnnotations...
  You must install or update .NET to run this application.

  App: C:\Users\Ben\.nuget\packages\resharper.exportannotations.task\1.4.0\tools\net6.0\ExportAnnotations.dll
  Architecture: x64
  Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
  .NET location: C:\Program Files\dotnet\

  The following frameworks were found:
    8.0.21 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    9.0.10 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

  Learn more:
  https://aka.ms/dotnet/app-launch-failed

  To install missing framework, download:
  https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=win-x64&os=win10
  C:\Users\Ben\.nuget\packages\resharper.exportannotations.task\1.4.0\build\ReSharper.ExportAnnotations.Task.Building.targets(85,5): error MSB3073: The command "dotnet C:\Users\Ben\.nuget\packages\resharper.exportannotations.task\1.4.0\tools\net6.0/ExportAnnotations.dll "C:\Users\Ben\Documents\Projects\MyLibrary\obj\Debug\net8.0\MyLibrary.dll" --liblist "obj\Debug\net8.0\ExportAnnotations.libraries"" exited with code -2147450730.

Metadata

Metadata

Assignees

Labels

bug[issue/PR] reports / solves a bug.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions