.NET Standard 1.2 - Fileversioninfo does not exist

Asked

Viewed 38 times

0

Follows code:

public static string GetVersion()
{
    return FileVersionInfo
                     .GetVersionInfo(Assembly.GetExecutingAssembly().Location)
                     .ProductVersion;
}

I get error:

  1. CS0103 The name "Fileversioninfo" does not exist in the current context
  2. CS0117 "Assembly" does not contain a definition for "Getexecutingassembly"

I am back. Netstandard with older version and get above errors.

There is another alternative to get the package version?

  • What version of . Net Framework? Why FileVersionInfo is from System.Diagnostics and the Assembly of System.Reflection

  • @Leandroangelo I’m doing with . net standard.

  • With this version of Standart it is not computable https://docs.microsoft.com/pt-br/dotnet/api/system.diagnostics.fileversioninfo?view=netframework-4.7.2. maybe you should put 1.3 which should be computable with what you are doing. ...

  • @Virgilionovic Need 1.2 because of . net framework 4.5.2. There is no other alternative to get the package version ?

  • 1

    Here just rolled with the netstandard2.0 or netcoreapp2.0... I only have 1.0, 1.1, 2.0 and 2.1 installed

  • Matheus himself is saying then that he needs this package to run as well 4.5.2 ??? if so has a way to do so and you put 4.5.2 and 1.3 in the same package!

  • @Virgilionovic check this link: https://docs.microsoft.com/pt-br/dotnet/standard/net-standard#net-implementation-support

  • I would make package available for 4.5.2 and 1.3 for example run the package on both netframework...

  • @Virgilionovic version 1.3 at least is 4.6 of the framework is not ?

  • Yes, but, because you only put it in the package, there is a way to put two or more settings that there the adpata package, example <TargetFrameworks>net45;netstandard2.0</TargetFrameworks> this for you would solve this method would be computable

  • You want your netstandard is compatible with version 4.5?

  • 1

    @Virgilionovic actually 4.5.1 or later

Show 7 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.