.NET Standard 2.1
dotnet add package ValveKeyValue --version
NuGet\Install-Package ValveKeyValue -Version
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ValveKeyValue" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ValveKeyValue --version
#r "nuget: ValveKeyValue,"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ValveKeyValue as a Cake Addin
#addin nuget:?package=ValveKeyValue&version=

// Install ValveKeyValue as a Cake Tool
#tool nuget:?package=ValveKeyValue&version=

Valve's KeyValue for .NET

Build Status (GitHub) NuGet Coverage Status

This library aims to be fully compatible with Valve's various implementations of KeyValues format parsing (believe us, it's not consistent).


Used by Steam and the Source engine.

Deserializing text

Basic deserialization

var stream = File.OpenRead("file.vdf"); // or any other Stream

var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
KVObject data = kv.Deserialize(stream);

Console.WriteLine(data["some key"]);

Typed deserialization

public class SimpleObject
	public string Name { get; set; }
	public string Value { get; set; }

var stream = File.OpenRead("file.vdf"); // or any other Stream

var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
KVObject data = kv.Deserialize<SimpleObject>(stream);


Deserialize method also accepts an KVSerializerOptions object.

By default, operating system specific conditionals are enabled based on the OS the code is running on (RuntimeInformation).

KVSerializerOptions accepts has the following options:

  • Conditions - List of conditions to use to match conditional values.
  • HasEscapeSequences - Whether the parser should translate escape sequences (e.g. \n, \t).
  • EnableValveNullByteBugBehavior - Whether invalid escape sequences should truncate strings rather than throwing a InvalidDataException.
  • FileLoader - Provider for referenced files with #include or #base directives.
var options = new KVSerializerOptions
    HasEscapeSequences = true,
options.Conditions.Clear(); // Remove default conditionals set by the library

var stream = File.OpenRead("file.vdf");

var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
var data = kv.Deserialize(stream, options);

Deserializing binary

Essentially the same text, just change KeyValues1Text to KeyValues1Binary.

Serializing to text

class DataObject
	public string Name { get; set; }

	public string Developer { get; set; }

	public string Summary { get; set; }

	public string ExtraData { get; set; }

var data = new DataObject
	Developer = "Valve Software",
	Name = "Dota 2",
	Summary = "Dota 2 is a complex game.",
	ExtraData = "This will not be serialized."

using var stream = File.OpenWrite("file.vdf");

var kv = KVSerializer.Create(KVSerializationFormat.KeyValues1Text);
kv.Serialize(stream, data, "root object name");

Serializing to binary

Essentially the same text, just change KeyValues1Text to KeyValues1Binary.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on ValveKeyValue:

Package Downloads

Library for finding games installed with Steam.


Library to decompile Valve Source 2 files


GameLib.NET is a library to give .NET developers easy access to the users installed game launchers and installed games.


Utility class for interacting with Steam.


次元超越 SteamClient 库

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on ValveKeyValue:

Repository Stars
🔬 Valve's Source 2 resource file format parser and decompiler
DisplayMagician is an open source tool for automatically configuring your displays and sound for a game or application from a single Windows Shortcut.
A tool to assist in the compiling of source engine maps
Version Downloads Last updated 11,841 6/5/2023 68,547 8/26/2022 3,681 2/9/2022 718 2/4/2022
0.7.1 694 1/13/2022 1,000 9/8/2021 2,617 9/17/2020
0.4.2 1,196 7/30/2020
0.4.1 584 7/29/2020 1,208 6/23/2020 531 6/23/2020 1,462 3/4/2020 3,127 1/16/2018 1,105 1/13/2018 917 1/13/2018
0.0.1 1,959 3/31/2016