Packaging a library for NuGet

Now, let's package the SharedLibrary project that you created earlier.

In the SharedLibrary project, rename Class1.cs to StringExtensions.cs, and modify its contents, as shown in the following code:

using System.Text.RegularExpressions;namespace Packt.CS7{   public static class StringExtensions   {      public static bool IsValidXmlTag(this string input)      {         return Regex.IsMatch(input,            @"^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$");      }      public static bool IsValidPassword(this string input)      {         // minimum of eight valid characters         return Regex.IsMatch(input, "^[a-zA-Z0-9_-]{8,}$");      }      public static bool IsValidHex(this string input)      {         // three or six valid hex number characters         return Regex.IsMatch(input,  "^#?([a-fA-F0-9]{3}|[a-fA-F0-9]{6})$"); ...

Get C# 7.1 and .NET Core 2.0 – Modern Cross-Platform Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.