vCardLib.dll 6.2.0

dotnet add package vCardLib.dll --version 6.2.0
                    
NuGet\Install-Package vCardLib.dll -Version 6.2.0
                    
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="vCardLib.dll" Version="6.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="vCardLib.dll" Version="6.2.0" />
                    
Directory.Packages.props
<PackageReference Include="vCardLib.dll" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add vCardLib.dll --version 6.2.0
                    
#r "nuget: vCardLib.dll, 6.2.0"
                    
#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.
#:package vCardLib.dll@6.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=vCardLib.dll&version=6.2.0
                    
Install as a Cake Addin
#tool nuget:?package=vCardLib.dll&version=6.2.0
                    
Install as a Cake Tool

vCardLib

Build, Test & Coverage codecov NuGet Version NET Standard NET Standard License: MIT

vCardLib is a .NET library for reading and writing vCard (.vcf) contacts. It targets .NET Standard 1.3 and .NET Standard 2.0 and supports vCard 2.1, 3.0, and 4.0.

Deprecation notice

The .NET Standard 1.3 target is scheduled to be removed in a future major release. Prefer .NET Standard 2.0 or a current .NET (6+) for new projects.

Features

  • Parse one or many contacts from a file path, a Stream, or a string (IEnumerable<vCard>).
  • Serialize a single vCard or a collection to a string, with an optional output version override.
  • Line unfolding when reading: a physical line that begins with a space or tab is merged into the previous line (RFC-style folding). For vCard 2.1, a line ending with = is also merged with the next line (quoted-printable-style continuation).
  • Rich vCard model: names, formatted name, phones, emails, addresses, photos, categories, dates, gender, kind, URLs, timezone, geo, custom X- properties, and more (see vCardLib.Models).

Installation

Package Manager

Install-Package vCardLib.dll

.NET CLI

dotnet add package vCardLib.dll

The NuGet package id is vCardLib.dll. The latest published version is shown on the badge above.

Usage

using vCardLib.Deserialization;
using vCardLib.Enums;
using vCardLib.Models;
using vCardLib.Serialization;

Deserialization

From a file

IEnumerable<vCard> contacts = vCardDeserializer.FromFile(@"C:\contacts\people.vcf");

From a stream

// Encoding is chosen from a BOM when possible; the stream must be readable and seekable
// so the BOM probe can rewind (see FileDataHelpers.GetEncoding).
IEnumerable<vCard> contacts = vCardDeserializer.FromStream(stream);

From a string

FromContent requires, in order:

  1. Non-whitespace input.
  2. The text must start with BEGIN:VCARD and end with END:VCARD (exact token match; leading or trailing whitespace is not stripped). A UTF-8 BOM at the start will cause the begin check to fail unless you remove it first.
  3. A VERSION property must appear in the payload.
var vcf = @"BEGIN:VCARD
VERSION:2.1
N:Doe;John;;;
FN:John Doe
END:VCARD";

IEnumerable<vCard> contacts = vCardDeserializer.FromContent(vcf);

Serialization

Only properties you set are written. Line breaks follow Environment.NewLine (platform default), not forced CRLF.

Single card

var card = new vCard(vCardVersion.v2)
{
    FormattedName = "John Doe"
};
string text = vCardSerializer.Serialize(card);
// Example (Windows): lines separated by \r\n
// BEGIN:VCARD
// VERSION:2.1
// FN:John Doe
// END:VCARD

Version override (emit another vCard version from the same in-memory card)

string asV4 = vCardSerializer.Serialize(card, vCardVersion.v4);

Multiple cards

string bundle = vCardSerializer.Serialize(new[] { card1, card2 });

API summary

Operation Entry point
Parse file vCardDeserializer.FromFile(string path)
Parse stream vCardDeserializer.FromStream(Stream stream)
Parse string vCardDeserializer.FromContent(string vcf)
Serialize one vCardSerializer.Serialize(vCard card, vCardVersion? overrideVersion = null)
Serialize many vCardSerializer.Serialize(IEnumerable<vCard> cards, vCardVersion? overrideVersion = null)

Versions: use enum members vCardVersion.v2, vCardVersion.v3, and vCardVersion.v4 (not V2 / V4).

vCard 2.1 note: NICKNAME is not written for v2 output (not part of RFC 2426); other versions emit it when NickName is set.

Contributors

Thanks to @bolorundurowb, @crowar, @rmja, and @JeanCollas.

License

MIT. See LICENSE.

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
6.2.0 606 4/19/2026
6.2.0-beta.0 51 4/18/2026
6.1.0 9,270 1/2/2026
6.0.0 30,702 9/28/2024
5.0.2 11,493 9/21/2024
5.0.1 21,510 6/13/2024
5.0.0 12,874 2/15/2024
4.0.4 55,855 7/19/2023
4.0.3 28,689 6/26/2022
4.0.2 11,225 6/22/2022
4.0.1 12,483 1/3/2022
4.0.0 11,261 12/12/2021
3.0.5 11,115 1/3/2022
3.0.4 11,094 12/12/2021
3.0.3 12,696 11/28/2021
3.0.2 11,398 10/11/2021
3.0.1 18,538 7/4/2020
3.0.0 11,443 5/31/2020
2.2.6 11,958 8/23/2019
2.2.5 12,784 2/8/2018
Loading failed

- improve RFC compatibility  when serialising and deserialising photo, address and address types
- Improve new line handling and conformance to the RFC spec