mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
When creating a nupkg file, don’t include assemblies that are part of the Orchard Frx (e.g. System.Web.Mvc.dll)
--HG-- branch : dev
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Net.Mime;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using NuGet;
|
using NuGet;
|
||||||
|
using Orchard.Environment;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
using Orchard.Environment.Extensions.Models;
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.FileSystems.VirtualPath;
|
using Orchard.FileSystems.VirtualPath;
|
||||||
@@ -18,6 +19,7 @@ namespace Orchard.Packaging.Services {
|
|||||||
public class PackageBuilder : IPackageBuilder {
|
public class PackageBuilder : IPackageBuilder {
|
||||||
private readonly IWebSiteFolder _webSiteFolder;
|
private readonly IWebSiteFolder _webSiteFolder;
|
||||||
private readonly IVirtualPathProvider _virtualPathProvider;
|
private readonly IVirtualPathProvider _virtualPathProvider;
|
||||||
|
private readonly IOrchardFrameworkAssemblies _frameworkAssemblies;
|
||||||
|
|
||||||
private static readonly string[] _ignoredThemeExtensions = new[] {
|
private static readonly string[] _ignoredThemeExtensions = new[] {
|
||||||
"obj", "pdb", "exclude"
|
"obj", "pdb", "exclude"
|
||||||
@@ -34,9 +36,12 @@ namespace Orchard.Packaging.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PackageBuilder(IWebSiteFolder webSiteFolder,
|
public PackageBuilder(IWebSiteFolder webSiteFolder,
|
||||||
IVirtualPathProvider virtualPathProvider) {
|
IVirtualPathProvider virtualPathProvider,
|
||||||
|
IOrchardFrameworkAssemblies frameworkAssemblies) {
|
||||||
|
|
||||||
_webSiteFolder = webSiteFolder;
|
_webSiteFolder = webSiteFolder;
|
||||||
_virtualPathProvider = virtualPathProvider;
|
_virtualPathProvider = virtualPathProvider;
|
||||||
|
_frameworkAssemblies = frameworkAssemblies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stream BuildPackage(ExtensionDescriptor extensionDescriptor) {
|
public Stream BuildPackage(ExtensionDescriptor extensionDescriptor) {
|
||||||
@@ -112,10 +117,14 @@ namespace Orchard.Packaging.Services {
|
|||||||
|
|
||||||
foreach (var entry in entries) {
|
foreach (var entry in entries) {
|
||||||
var assemblyName = new AssemblyName(entry.Include.Value);
|
var assemblyName = new AssemblyName(entry.Include.Value);
|
||||||
string virtualPath = _virtualPathProvider.GetReferenceVirtualPath(context.SourcePath, assemblyName.Name, entry.HintPath != null ? entry.HintPath.Value : null);
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(virtualPath)) {
|
// If it is not a core assembly
|
||||||
EmbedVirtualFile(context, virtualPath, MediaTypeNames.Application.Octet);
|
if (_frameworkAssemblies.GetFrameworkAssemblies().FirstOrDefault(assembly => assembly.FullName.Equals(assemblyName.FullName)) == null) {
|
||||||
|
string virtualPath = _virtualPathProvider.GetReferenceVirtualPath(context.SourcePath, assemblyName.Name, entry.HintPath != null ? entry.HintPath.Value : null);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(virtualPath)) {
|
||||||
|
EmbedVirtualFile(context, virtualPath, MediaTypeNames.Application.Octet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Orchard.Environment {
|
||||||
|
public interface IOrchardFrameworkAssemblies : IDependency {
|
||||||
|
IEnumerable<AssemblyName> GetFrameworkAssemblies();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class DefaultOrchardFrameworkAssemblies : IOrchardFrameworkAssemblies {
|
||||||
|
public IEnumerable<AssemblyName> GetFrameworkAssemblies() {
|
||||||
|
return typeof (IDependency).Assembly.GetReferencedAssemblies();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,6 @@ using System.Web.WebPages.Razor;
|
|||||||
using Orchard.Environment;
|
using Orchard.Environment;
|
||||||
using Orchard.Environment.Extensions.Loaders;
|
using Orchard.Environment.Extensions.Loaders;
|
||||||
using Orchard.FileSystems.Dependencies;
|
using Orchard.FileSystems.Dependencies;
|
||||||
using Orchard.FileSystems.VirtualPath;
|
|
||||||
|
|
||||||
namespace Orchard.Mvc.ViewEngines.Razor {
|
namespace Orchard.Mvc.ViewEngines.Razor {
|
||||||
public interface IRazorCompilationEvents {
|
public interface IRazorCompilationEvents {
|
||||||
|
|||||||
@@ -185,6 +185,7 @@
|
|||||||
<Compile Include="Environment\Features\FeatureManager.cs" />
|
<Compile Include="Environment\Features\FeatureManager.cs" />
|
||||||
<Compile Include="Environment\IAssemblyLoader.cs" />
|
<Compile Include="Environment\IAssemblyLoader.cs" />
|
||||||
<Compile Include="Environment\HostComponentsConfigModule.cs" />
|
<Compile Include="Environment\HostComponentsConfigModule.cs" />
|
||||||
|
<Compile Include="Environment\IOrchardFrameworkAssemblies.cs" />
|
||||||
<Compile Include="Environment\ViewsBackgroundCompilation.cs" />
|
<Compile Include="Environment\ViewsBackgroundCompilation.cs" />
|
||||||
<Compile Include="Environment\Warmup\StartupResult.cs" />
|
<Compile Include="Environment\Warmup\StartupResult.cs" />
|
||||||
<Compile Include="Environment\Warmup\WarmupUtility.cs" />
|
<Compile Include="Environment\Warmup\WarmupUtility.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user