[CSHARP-3640] Issue with Building/Loading Projects in VS2015 after Upgrading to Driver 2.12.2 Created: 04/May/21  Updated: 27/Oct/23  Resolved: 04/May/21

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Unknown
Reporter: Jasmeet Sangari Assignee: James Kovacs
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

VS2015


Issue Links:
Related

 Description   

Hello ,

We have been Using VS2015 as the IDE for development. We Upgraded to  Driver 2.12.2 and now the Project does not load in VS2015. We get the following error:

'

MongoDB.Libmongocrypt.targets 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`)).



 Comments   
Comment by James Kovacs [ 04/May/21 ]

Hi, Jasmeet,

I was incorrect. Operating system detection was added in the 2.10.0 version of the driver. So you would have to use 2.9.x or earlier if you wanted to go that route.

James

Comment by James Kovacs [ 04/May/21 ]

Hi, Jasmeet,

Thank you for contacting MongoDB about the error when attempting to use recent versions of the MongoDB .NET/C# driver with Microsoft Visual Studio 2015.

Our NuGet package uses [MSBuild]::IsOsPlatform() for operating system detection, which is unfortunately not available in the version of MSBuild shipped with VS2015. VS2015 is over 6 years old and reached mainstream end-of-life on 2020-10-13.

We recommend upgrading to VS2017 or VS2019, which does support the required MSBuild method. If this is not possible, you can use a recent version of the command line tools (e.g. `msbuild.exe, `dotnet.exe`, and/or `nuget.exe`) to install packages and build your source while still using VS2015 to write your code. Driver versions 2.10.x and earlier did not include features requiring operating system detection and should still work in VS2015, though you would not benefit from features and bug fixes in the newer driver versions.

Hopefully that provides you some options to work around this issue. The best option is definitely to update to VS2017 or VS2019.

Sincerely,
James

Generated at Wed Feb 07 21:45:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.