Search code examples
c#visual-studio-2013msbuildmongodb-.net-driver

How to install MongoDB.Driver in Visual Studio 2013


I'm using Visual Studio Ultimate 2013 trying to install MongoDB.Driver package in my project(.NET Framework 4.6) and I got the following error:

Invalid static method invocation syntax: "[MSBuild]::IsOsPlatform('Windows')". Method '[MSBuild]::IsOsPlatform' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a, b)).
C:\ProjectPath\packages\MongoDB.Libmongocrypt.1.0.0\build\MongoDB.Libmongocrypt.targets

I tried installing in others projects and repairing visual studio but it didn`t work.


Solution

  • Share my experience: 2020年1月6日 07:27:40

    when i used

    Install-Package MongoDB.Driver
    

    in my project(.NET Framework 4.6.1)

    Package Manager Console print:

    Invalid static method invocation syntax: "[MSBuild]::IsOsPlatform('Windows')". Method '[MSBuild]::IsOsPlatform' not found.

    I just restart my vs2015 ,I try install this package by

    Install-Package MongoDB.Driver -Version 2.5.0
    

    i successed!