mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 17:08:47 +08:00
Delete 'Trust Level="Medium"' element for package
--HG-- branch : dev
This commit is contained in:
parent
ce4c6d6ca5
commit
cb8b5f3812
@ -134,6 +134,7 @@
|
||||
<UsingTask AssemblyFile="$(MsBuildTasksFolder)\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.FilterModuleBinaries" />
|
||||
<UsingTask AssemblyFile="$(MsBuildTasksFolder)\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.FileUpdateLines" />
|
||||
<UsingTask AssemblyFile="$(MsBuildTasksFolder)\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.ValidateExtensionProjectFiles" />
|
||||
<UsingTask AssemblyFile="$(MsBuildTasksFolder)\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.XmlDelete" />
|
||||
|
||||
<Target Name="Package-Stage">
|
||||
<CallTarget Targets="CompileMsBuildTasks"/>
|
||||
@ -207,6 +208,9 @@
|
||||
XPath="/configuration/system.web/compilation/@debug"
|
||||
Value="false" />
|
||||
|
||||
<XmlDelete XmlFileName="$(StageFolder)\web.config"
|
||||
XPath="/configuration/system.web/trust" />
|
||||
|
||||
<XmlUpdate XmlFileName="$(StageFolder)\web.config"
|
||||
XPath="/configuration/system.web/machineKey/@validationKey"
|
||||
Value="AutoGenerate" />
|
||||
@ -215,13 +219,13 @@
|
||||
XPath="/configuration/system.web/machineKey/@decryptionKey"
|
||||
Value="AutoGenerate" />
|
||||
|
||||
<XmlUpdate XmlFileName="$(StageFolder)\Config\Diagnostics.config"
|
||||
<!--<XmlUpdate XmlFileName="$(StageFolder)\Config\Diagnostics.config"
|
||||
XPath="/system.diagnostics/trace/@autoflush"
|
||||
Value="false" />
|
||||
|
||||
<XmlUpdate XmlFileName="$(StageFolder)\Config\Diagnostics.config"
|
||||
XPath="/system.diagnostics/sources/source/@switchValue"
|
||||
Value="Error" />
|
||||
Value="Error" />-->
|
||||
|
||||
<!-- move over extra non-content files the csproj referenced -->
|
||||
<Copy SourceFiles="@(StageProjectAlteration-ExtraFiles->'$(SrcFolder)\Orchard.Web\%(Identity)')"
|
||||
|
@ -66,6 +66,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="XmlDelete.cs" />
|
||||
<Compile Include="ValidateExtensionProjectFiles.cs" />
|
||||
<Compile Include="FileUpdateLines.cs" />
|
||||
<Compile Include="FilterModuleBinaries.cs" />
|
||||
|
52
src/Tools/MSBuild.Orchard.Tasks/XmlDelete.cs
Normal file
52
src/Tools/MSBuild.Orchard.Tasks/XmlDelete.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace MSBuild.Orchard.Tasks {
|
||||
public class XmlDelete : Task {
|
||||
|
||||
public string Namespace { get; set; }
|
||||
public string Prefix { get; set; }
|
||||
[Required]
|
||||
public string XmlFileName { get; set; }
|
||||
[Required]
|
||||
public string XPath { get; set; }
|
||||
|
||||
public override bool Execute() {
|
||||
try {
|
||||
var document = new XmlDocument();
|
||||
document.Load(this.XmlFileName);
|
||||
|
||||
var navigator = document.CreateNavigator();
|
||||
var nsResolver = new XmlNamespaceManager(navigator.NameTable);
|
||||
|
||||
if (!string.IsNullOrEmpty(this.Prefix) && !string.IsNullOrEmpty(this.Namespace)) {
|
||||
nsResolver.AddNamespace(this.Prefix, this.Namespace);
|
||||
}
|
||||
|
||||
var expr = XPathExpression.Compile(this.XPath, nsResolver);
|
||||
|
||||
var iterator = navigator.Select(expr);
|
||||
while (iterator.MoveNext()) {
|
||||
iterator.Current.DeleteSelf();
|
||||
}
|
||||
|
||||
using (var writer = new XmlTextWriter(this.XmlFileName, Encoding.UTF8)) {
|
||||
writer.Formatting = Formatting.Indented;
|
||||
document.Save(writer);
|
||||
writer.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception exception) {
|
||||
base.Log.LogErrorFromException(exception);
|
||||
return false;
|
||||
}
|
||||
base.Log.LogMessage("Updated file '{0}'", new object[] { this.XmlFileName });
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user