Can I claim a lower version of .NET than it really is?

Sharepoint 2010 has version check in one place (also starting with some update WSS 3.0 also has this check):

...
Version version = Environment.Version;
if (version.Major > 2)
{
    ...
    throw new PlatformNotSupportedException(@string);

I know that I should not do this, but just out of curiosity - can this be overcome without writing a huge proxy?

Just out of curiosity, wondering if one can make any of this:

  • adjust this check in the sharepoint dll at runtime to pass (the class that uses it is sealed and internal, if you're interested, this is the Microsoft.SharePoint.Administration.SPConfigurationDatabase class in Microsoft.Sharepoint.dll)
  • temporarily overriding Environment.Version returns a value, for example:

    using (new EnvironmentVersionOverride("2.0")) { ... }

  • in any other way?

: Environment.Version :

public static Version Version
{
  get
  {
    return new Version("4.0.30319.18444");
  }
}
+4
1

, WSS 3.0/Share Point 2010 , Microsoft , CLR WSS 3.0/Share Point 2010 .

, Environment.Version CLR ( .NET Framework), . "" "" . SharePoint Windows 7, Windows Server 2008 Windows Server 2008 R2, CLR 2.0 ( Windows 8 Windows Server 2012).

, , IIS, - Share Point 2010 ( WSS 3.0), .Net Framework 2.0.50727 ( CLR 2.0). , Share Point 2010 , - , .NET Framework 4.0.

, Share Point 2010/WSS 3.0, .NET Framework 3.5 1 ( CLR 2.0), , "" Environment.Version.

Share Point 2010, , .NET Framework 3.5.

+1

Source: https://habr.com/ru/post/1546248/


All Articles