Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssemblyVersionLayoutRenderer not working for net451 + net461 #222

Closed
snakefoot opened this issue Nov 30, 2017 · 2 comments · Fixed by #224
Closed

AssemblyVersionLayoutRenderer not working for net451 + net461 #222

snakefoot opened this issue Nov 30, 2017 · 2 comments · Fixed by #224

Comments

@snakefoot
Copy link
Contributor

snakefoot commented Nov 30, 2017

Think there are some problems

  • NLog.Web.AspNetCore.csproj - This will cause net451to include PlatformAbstractions:
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
   <PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.0.0" />
  • AssemblyVersionLayoutRenderer.cs - The first #if will match net451
#if ASP_NET_CORE && !NETSTANDARD2_0
        private static string GetAssemblyVersion()
        {
            return PlatformServices.Default.Application.RuntimeFramework.Version.ToString();
        }
#elif NETSTANDARD2_0
        private static string GetAssemblyVersion()
        {
            return System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();
        }
#else

There is also missing a null-check for GetEntryAssembly() for NETSTANDARD2_0, as it can return null.

Not sure why NetStandard15 cannot use GetEntryAssembly() just like NETSTANDARD2_0?

Instead of using PlatformServices.Default.Application.RuntimeFramework.Version for NetStandard13, then it should be:

Microsoft.Extensions.PlatformAbstractions.PlatformServices.Default.Application.ApplicationVersion

@304NotModified 304NotModified changed the title AssemblyVersionLayoutRenderer not working for net451 AssemblyVersionLayoutRenderer not working for net451 + net461 Nov 30, 2017
@304NotModified
Copy link
Member

NLog.Web.AspNetCore.csproj - This will cause net451to include PlatformAbstractions:

Is this a problem? .NET 4.51+ is supported? https://www.nuget.org/packages/Microsoft.Extensions.PlatformAbstractions/

@snakefoot
Copy link
Contributor Author

Is this a problem? .NET 4.51+ is supported?

No just unnecessary dependencies. Only needed for NetStandard1.3, so maybe just move it to a seperate section for NetStandard1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants