Skip to content

Commit

Permalink
Added reference to the NuGet.Core package on nuget.org and replaced s…
Browse files Browse the repository at this point in the history
…ome duplicated objects and interfaces.

Using the original NuGet.Core library it now supports more recent frameworks like dnx451
  • Loading branch information
Jeroen Versteege committed Oct 14, 2015
1 parent 91ad37a commit 6962ecc
Show file tree
Hide file tree
Showing 150 changed files with 289 additions and 1,224 deletions.
2 changes: 1 addition & 1 deletion Core/Authoring/IPackageBuilder.cs
@@ -1,7 +1,7 @@
using System.Collections.ObjectModel;
using System.IO;

namespace NuGet
namespace NuGetPe
{
public interface IPackageBuilder : IPackageMetadata
{
Expand Down
5 changes: 3 additions & 2 deletions Core/Authoring/Manifest.cs
Expand Up @@ -12,9 +12,10 @@
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.Serialization;
using NuGet.Resources;
using NuGet;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
[XmlType("package")]
public class Manifest
Expand Down
4 changes: 2 additions & 2 deletions Core/Authoring/ManifestDependency.cs
@@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using NuGet.Resources;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
[XmlType("dependency")]
public class ManifestDependency
Expand Down
2 changes: 1 addition & 1 deletion Core/Authoring/ManifestDependencySet.cs
Expand Up @@ -2,7 +2,7 @@
using System.Xml;
using System.Xml.Serialization;

namespace NuGet
namespace NuGetPe
{
[XmlType("group")]
public class ManifestDependencySet
Expand Down
4 changes: 2 additions & 2 deletions Core/Authoring/ManifestFile.cs
Expand Up @@ -5,9 +5,9 @@
using System.IO;
using System.Linq;
using System.Xml.Serialization;
using NuGet.Resources;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
[XmlType("file")]
public class ManifestFile : IValidatableObject
Expand Down
2 changes: 1 addition & 1 deletion Core/Authoring/ManifestFileList.cs
Expand Up @@ -2,7 +2,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Xml.Serialization;

namespace NuGet
namespace NuGetPe
{
/// <summary>
/// This class is used to work around the bug (or bad design, depending on how you look at it) in .NET XML
Expand Down
4 changes: 2 additions & 2 deletions Core/Authoring/ManifestFrameworkAssembly.cs
@@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using NuGet.Resources;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
[XmlType("frameworkAssembly")]
public class ManifestFrameworkAssembly
Expand Down
11 changes: 4 additions & 7 deletions Core/Authoring/ManifestMetadata.cs
Expand Up @@ -7,9 +7,10 @@
using System.Linq;
using System.Runtime.Versioning;
using System.Xml.Serialization;
using NuGet.Resources;
using NuGet;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
[XmlType("metadata")]
public sealed class ManifestMetadata : IPackageMetadata, IValidatableObject
Expand Down Expand Up @@ -342,11 +343,7 @@ public IEnumerable<ValidationResult> Validate(ValidationContext validationContex
{
if (!String.IsNullOrEmpty(Id))
{
if (Id.Length > PackageIdValidator.MaxPackageIdLength)
{
yield return new ValidationResult(String.Format(CultureInfo.CurrentCulture, NuGetResources.Manifest_IdMaxLengthExceeded));
}
else if (!PackageIdValidator.IsValidPackageId(Id))
if (!NuGet.PackageIdValidator.IsValidPackageId(Id))
{
yield return new ValidationResult(String.Format(CultureInfo.CurrentCulture, NuGetResources.InvalidPackageId, Id));
}
Expand Down
4 changes: 2 additions & 2 deletions Core/Authoring/ManifestReader.cs
Expand Up @@ -3,9 +3,9 @@
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using NuGet.Resources;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
internal static class ManifestReader
{
Expand Down
4 changes: 2 additions & 2 deletions Core/Authoring/ManifestReference.cs
@@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using NuGet.Resources;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
[XmlType("reference")]
public class ManifestReference
Expand Down
2 changes: 1 addition & 1 deletion Core/Authoring/ManifestReferenceSet.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Xml.Serialization;

namespace NuGet
namespace NuGetPe
{
public class ManifestReferenceSet
{
Expand Down
4 changes: 2 additions & 2 deletions Core/Authoring/ManifestSchemaUtility.cs
Expand Up @@ -5,9 +5,9 @@
using System.Linq;
using System.Xml;
using System.Xml.Schema;
using NuGet.Resources;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
internal static class ManifestSchemaUtility
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Authoring/ManifestVersionAttribute.cs
@@ -1,6 +1,6 @@
using System;

namespace NuGet
namespace NuGetPe
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
internal sealed class ManifestVersionAttribute : Attribute
Expand Down
6 changes: 3 additions & 3 deletions Core/Authoring/ManifestVersionUtility.cs
Expand Up @@ -4,7 +4,7 @@
using System.Reflection;
using System.Xml.Serialization;

namespace NuGet
namespace NuGetPe
{
internal class ManifestVersionUtility
{
Expand Down Expand Up @@ -45,8 +45,8 @@ private static int GetVersionFromMetadata(ManifestMetadata metadata)
return TargetFrameworkSupportForDependencyContentsAndToolsVersion;
}

SemanticVersion semanticVersion;
if (SemanticVersion.TryParse(metadata.Version, out semanticVersion) && !String.IsNullOrEmpty(semanticVersion.SpecialVersion))
NuGet.SemanticVersion semanticVersion;
if (NuGet.SemanticVersion.TryParse(metadata.Version, out semanticVersion) && !String.IsNullOrEmpty(semanticVersion.SpecialVersion))
{
return SemverVersion;
}
Expand Down
12 changes: 6 additions & 6 deletions Core/Authoring/PackageBuilder.cs
Expand Up @@ -6,9 +6,9 @@
using System.IO;
using System.IO.Packaging;
using System.Linq;
using NuGet.Resources;
using NuGetPe.Resources;

namespace NuGet
namespace NuGetPe
{
public sealed class PackageBuilder : IPackageBuilder
{
Expand Down Expand Up @@ -59,7 +59,7 @@ public PackageBuilder()

public string Id { get; set; }

public SemanticVersion Version { get; set; }
public NuGet.SemanticVersion Version { get; set; }

public string Title { get; set; }

Expand Down Expand Up @@ -137,7 +137,7 @@ IEnumerable<FrameworkAssemblyReference> IPackageMetadata.FrameworkAssemblies
public void Save(Stream stream)
{
// Make sure we're saving a valid package id
PackageIdValidator.ValidatePackageId(Id);
NuGet.PackageIdValidator.ValidatePackageId(Id);

// Throw if the package doesn't contain any dependencies nor content
if (!Files.Any() && !DependencySets.Any() && !FrameworkReferences.Any())
Expand Down Expand Up @@ -218,7 +218,7 @@ private static bool RequiresV4TargetFrameworkSchema(ICollection<IPackageFile> fi

#endregion

internal static void ValidateDependencySets(SemanticVersion version, IEnumerable<PackageDependencySet> dependencies)
internal static void ValidateDependencySets(NuGet.SemanticVersion version, IEnumerable<PackageDependencySet> dependencies)
{
if (version == null)
{
Expand Down Expand Up @@ -257,7 +257,7 @@ internal static void ValidateReferenceAssemblies(IEnumerable<IPackageFile> files

private static bool IsPrereleaseDependency(PackageDependency dependency)
{
IVersionSpec versionSpec = dependency.VersionSpec;
var versionSpec = dependency.VersionSpec;
if (versionSpec != null)
{
return (versionSpec.MinVersion != null && !String.IsNullOrEmpty(dependency.VersionSpec.MinVersion.SpecialVersion)) ||
Expand Down
2 changes: 1 addition & 1 deletion Core/Authoring/PathResolver.cs
Expand Up @@ -4,7 +4,7 @@
using System.Linq;
using System.Text.RegularExpressions;

namespace NuGet
namespace NuGetPe
{
public static class PathResolver
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Authoring/PhysicalPackageFile.cs
@@ -1,6 +1,6 @@
using System.IO;

namespace NuGet
namespace NuGetPe
{
public sealed class PhysicalPackageFile : PackageFileBase
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Configuration/ISettings.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;

namespace NuGet
namespace NuGetPe
{
public interface ISettings
{
Expand Down
4 changes: 2 additions & 2 deletions Core/Configuration/UserSettings.cs
Expand Up @@ -3,11 +3,11 @@
using System.Globalization;
using System.IO;
using System.Xml.Linq;
using NuGet.Resources;
using NuGetPe.Resources;

//using Microsoft.Internal.Web.Utils;

namespace NuGet
namespace NuGetPe
{
public class UserSettings : ISettings
{
Expand Down
20 changes: 13 additions & 7 deletions Core/Core.csproj
Expand Up @@ -46,6 +46,14 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.XmlTransform, Version=2.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NuGet.Core, Version=2.8.60717.93, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\NuGet.Core.2.8.6\lib\net40-Client\NuGet.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -100,8 +108,6 @@
<Compile Include="Repositories\MachineCache.cs" />
<Compile Include="Extensions\AssemblyExtensions.cs" />
<Compile Include="Extensions\CollectionExtensions.cs" />
<Compile Include="Utility\CryptoHashProvider.cs" />
<Compile Include="Utility\IHashProvider.cs" />
<Compile Include="Authoring\Manifest.cs" />
<Compile Include="Authoring\ManifestDependency.cs" />
<Compile Include="Authoring\ManifestFile.cs" />
Expand All @@ -113,17 +119,14 @@
</Compile>
<Compile Include="Extensions\ObjectExtensions.cs" />
<Compile Include="Extensions\PackageExtensions.cs" />
<Compile Include="Utility\PackageIdValidator.cs" />
<Compile Include="Utility\PackageUtility.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Utility\UriUtility.cs" />
<Compile Include="Utility\VersionSpec.cs" />
<Compile Include="Utility\VersionUtility.cs" />
<Compile Include="Utility\PackageUtility.cs" />
<Compile Include="Packages\ZipPackage.cs" />
<Compile Include="Packages\ZipPackageAssemblyReference.cs" />
<Compile Include="Packages\ZipPackageFile.cs" />
<Compile Include="Extensions\XElementExtensions.cs" />
<Compile Include="Utility\UriUtility.cs" />
<Compile Include="Utility\WebRequestEventArgs.cs" />
<Compile Include="Utility\XmlUtility.cs" />
</ItemGroup>
Expand Down Expand Up @@ -151,6 +154,9 @@
<Name>Types</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
2 changes: 1 addition & 1 deletion Core/Extensions/AssemblyExtensions.cs
@@ -1,6 +1,6 @@
using System.Reflection;

namespace NuGet
namespace NuGetPe
{
public static class AssemblyExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Extensions/CollectionExtensions.cs
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;

namespace NuGet
namespace NuGetPe
{
public static class CollectionExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Extensions/FileSystemExtensions.cs
@@ -1,7 +1,7 @@
using System;
using System.IO;

namespace NuGet
namespace NuGetPe
{
internal static class FileSystemExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Extensions/ObjectExtensions.cs
@@ -1,4 +1,4 @@
namespace NuGet
namespace NuGetPe
{
internal static class ObjectExtensions
{
Expand Down
11 changes: 4 additions & 7 deletions Core/Extensions/PackageExtensions.cs
Expand Up @@ -7,7 +7,7 @@
using System.Linq.Expressions;
using System.Reflection;

namespace NuGet
namespace NuGetPe
{
public static class PackageExtensions
{
Expand All @@ -21,16 +21,13 @@ public static bool IsReleaseVersion(this IPackageMetadata packageMetadata)

public static string GetHash(this IPackage package)
{
return GetHash(package, new CryptoHashProvider());
return GetHash(package, new NuGet.CryptoHashProvider());
}

public static string GetHash(this IPackage package, IHashProvider hashProvider)
public static string GetHash(this IPackage package, NuGet.IHashProvider hashProvider)
{
using (Stream stream = package.GetStream())
{
byte[] packageBytes = stream.ReadAllBytes();
return Convert.ToBase64String(hashProvider.CalculateHash(packageBytes));
}
return Convert.ToBase64String(hashProvider.CalculateHash(stream));
}

public static string GetFullName(this IPackageMetadata package)
Expand Down
2 changes: 1 addition & 1 deletion Core/Extensions/PluginExtensions.cs
@@ -1,7 +1,7 @@
using System;
using System.IO;

namespace NuGet
namespace NuGetPe
{
public static class PluginExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion Core/Extensions/SettingsExtensions.cs
Expand Up @@ -2,7 +2,7 @@
using System.Security.Cryptography;
using System.Text;

namespace NuGet
namespace NuGetPe
{
public static class SettingsExtensions
{
Expand Down

0 comments on commit 6962ecc

Please sign in to comment.