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=

<h1><img src="./Misc/logo.png" width="64" align="center"> Valve's KeyValue for .NET</h1>

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 as 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 as 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.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.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)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on ValveKeyValue:

Package Downloads

Library for finding games installed with Steam.


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


Library to decompile Valve Source 2 files


次元超越 SteamClient 库


Package Description

GitHub repositories (4)

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

Repository Stars
🔬 Valve's Source 2 resource file format parser, decompiler, and exporter.
DisplayMagician is an open source tool for automatically configuring your displays and sound for a game or application from a single Windows Shortcut.
Toolchain that lets you interact with the Overwatch files and extract models and stuff.
A tool to assist in the compiling of source engine maps
Version Downloads Last updated 10,880 3/22/2024 70,330 6/5/2023 128,396 8/26/2022 3,976 2/9/2022 1,009 2/4/2022
0.7.1 962 1/13/2022 1,271 9/8/2021 3,085 9/17/2020
0.4.2 1,524 7/30/2020
0.4.1 878 7/29/2020 2,616 6/23/2020 836 6/23/2020 1,764 3/4/2020 3,439 1/16/2018 1,423 1/13/2018 1,219 1/13/2018
0.0.1 2,283 3/31/2016