C#C
C#3y ago
muhammad

❔ How can I get version of installed Nuget package in .csprog file in visual studio.

0

I am using conditional compilation and in the condition I need to compare the installed version of a specific Nuget package with the given version. Can this be done inside .csprog file?

<ItemGroup>
  <PackageReference Include="MyPackages.AlphaPackage" Version="2.0.1" />
</ItemGroup>

<PropertyGroup Condition="True"> <!-- Here I want to check if Version of MyPackages.AlphaPackage is 2.0.1 -->
    <DefineConstants>Version2Installled</DefineConstants>
</PropertyGroup>  
Was this page helpful?