C #: load assembly link based on frame version?

Is it possible to download a reference assembly only if the version of the .NET Framework is less than a certain number?

I use the homemade LINQ library on .NET 2.0, but if the framework is 3.5+, it should use the M $ LINQ library and ignore the self-contained one.

Edit:
Here is my library:
http://linq4you.codeplex.com/

+4
source share
1 answer

Yes, you can do this by modifying the project file.

Open the csproj file in a text editor and find the line in the project file that describes the dependency that you want to conditionally load, and make sure it looks like this:

<Reference Include="LinqBridge" Condition="$(TargetFrameworkVersion)=='v2.0'"> <HintPath>..\..\..\DevSupport\Lib\LinqBridge\LinqBridge.dll</HintPath> <Private>True</Private> </Reference> 
+5
source

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


All Articles