CNPJValidatorV2 1.3.1

dotnet add package CNPJValidatorV2 --version 1.3.1
                    
NuGet\Install-Package CNPJValidatorV2 -Version 1.3.1
                    
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="CNPJValidatorV2" Version="1.3.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CNPJValidatorV2" Version="1.3.1" />
                    
Directory.Packages.props
<PackageReference Include="CNPJValidatorV2" />
                    
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 CNPJValidatorV2 --version 1.3.1
                    
#r "nuget: CNPJValidatorV2, 1.3.1"
                    
#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 CNPJValidatorV2@1.3.1
                    
#: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=CNPJValidatorV2&version=1.3.1
                    
Install as a Cake Addin
#tool nuget:?package=CNPJValidatorV2&version=1.3.1
                    
Install as a Cake Tool

CNPJValidatorV2

NuGet NuGet Downloads Build License

Biblioteca .NET para validação, cálculo de dígitos verificadores e formatação de CNPJ, com suporte a:

  • ✅ CNPJ numérico tradicional
  • ✅ CNPJ alfanumérico (com letras maiúsculas)
  • ✅ Entrada com ou sem máscara
  • ✅ Sanitização automática

Compatível com .NET Standard 2.0+


📦 Instalação

Via CLI:

dotnet add package CNPJValidatorV2

Via Package Manager:

Install-Package CNPJValidatorV2

Ou pelo Visual Studio → Manage NuGet Packages.


🚀 Compatibilidade

Por utilizar .NET Standard 2.0, o pacote é compatível com:

  • .NET Framework 4.6.1+
  • .NET Core 2.0+
  • .NET 5+
  • .NET 6+
  • .NET 7+
  • .NET 8+
  • Xamarin
  • Mono

🧪 Exemplos de Uso

✔ Validação

using CNPJValidatorV2.Core;

bool valido = CnpjValidator.IsValid("12.345.678/0001-95");

✔ Sanitização

string limpo = "12.345.678/0001-95".SanitizeCnpj();
// Resultado: 12345678000195

✔ Formatação

string formatado = "12345678000195".FormatCnpj();
// Resultado: 12.345.678/0001-95

✔ Cálculo de Dígitos Verificadores

string cnpjComDv = CnpjValidator.CalculateDv("12ABC34501DE");

🧩 Funcionalidades

  • Validação de CNPJ com regra oficial de DV
  • Suporte a letras maiúsculas
  • Extensões para string
  • Tratamento de entradas inválidas
  • Cobertura de testes 100%

🧪 Testes

O projeto possui testes automatizados utilizando xUnit.

Para executar:

dotnet test

📦 Versionamento

Este projeto segue Semantic Versioning (SemVer):

MAJOR.MINOR.PATCH

Exemplo:

  • 1.3.0 → melhoria compatível
  • 2.0.0 → mudança breaking

A publicação é automatizada via GitHub Actions ao criar uma tag:

git tag v1.3.0
git push origin v1.3.0

📄 Licença

Este projeto está licenciado sob a licença MIT.

© 2026 Tiago Ávila Saldanha

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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework 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 tizen40 was computed.  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.0

    • No dependencies.

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
1.3.1 2,806 2/21/2026
1.2.2 683 5/26/2025
1.2.1 245 5/18/2025
1.1.9 205 5/18/2025
1.1.8 196 5/18/2025
1.1.7 215 5/11/2025
1.1.6 228 5/11/2025
1.1.5 157 5/10/2025
1.1.4 175 5/10/2025
1.1.3 167 5/10/2025
1.1.2 173 5/10/2025
1.1.1 170 5/10/2025
1.0.1 168 5/10/2025
1.0.0 178 5/10/2025

- Migração para netstandard2.0 (compatível com .NET Framework 4.6.1+)
- Mantida compatibilidade com API existente