Orchard 1.7发布错误:无法从程序集加载“MSBuild.Orchard.Tasks.XmlDelete”任务

时间:2013-09-05 22:05:36

标签: asp.net-mvc-4 visual-studio-2012 msbuild publish orchardcms-1.7

我有一个当地的Orchard 1.7 cms网站,我已定制,等等。我的任务是通过Visual Studio Ultimate 2012将我的网站发布到我的主机(arvixe.com) - 通过发布选项。但是发布失败了,我得到了这个错误:

Error   1   The "MSBuild.Orchard.Tasks.XmlDelete" task could not be loaded from the assembly C:\Users\WilliamHolm\Documents\Visual Studio 2012\Projects\whj\src\Orchard.Web\..\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll. Could not load file or assembly 'file:///C:\Users\WilliamHolm\Documents\Visual Studio 2012\Projects\whj\src\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.   C:\Users\WilliamHolm\Documents\Visual Studio 2012\Projects\whj\src\Orchard.Web\Orchard.Web.csproj   247 5   Orchard.Web

通过查看错误位于第247行附近的源,在Orchard.Web.csproj中,它看起来像这样:

</Target>
  <Import Project="$(ProjectDir)..\..\lib\msbuild\MSBuild.Community.Tasks.Targets" />
  <UsingTask AssemblyFile="$(ProjectDir)..\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll" TaskName="MSBuild.Orchard.Tasks.XmlDelete" />
  <Target Name="ProcessConfigurationFiles" AfterTargets="CopyAllFilesToSingleFolderForMsdeploy">
    <PropertyGroup>
      <PackageTmp>$(ProjectDir)obj\Release\Package\PackageTmp</PackageTmp>
    </PropertyGroup>
    <!-- extra processing of the staged config files -->
    <XmlUpdate XmlFileName="$(PackageTmp)\web.config" XPath="/configuration/system.web/compilation/@debug" Value="false" />
    <XmlDelete XmlFileName="$(PackageTmp)\web.config" XPath="/configuration/system.web/trust" />
    <XmlUpdate XmlFileName="$(PackageTmp)\web.config" XPath="/configuration/system.web/machineKey/@validationKey" Value="AutoGenerate" />
    <XmlUpdate XmlFileName="$(PackageTmp)\web.config" XPath="/configuration/system.web/machineKey/@decryptionKey" Value="AutoGenerate" />
    <XmlUpdate XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/appender/immediateFlush/@value" Value="false" />
    <XmlUpdate XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/logger/priority/@value" Value="ERROR" />
    <XmlUpdate XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/root/priority/@value" Value="ERROR" />
    <XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/appender[@name='debug-file']" />
    <XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/appender[@name='debugger']" />
    <XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/appender[@name='error-file']/filter" />
    <XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/logger[@name='Orchard.Localization']" />
    <XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/logger[@name='Orchard']" />
    <XmlDelete XmlFileName="$(PackageTmp)\Config\log4net.config" XPath="/log4net/root/appender-ref[@ref='debug-file']" />
    <!-- disable all file monitoring but ExtensionMonitoringCorrdinator to detect new modules/themes -->
    <XmlUpdate XmlFileName="$(PackageTmp)\Config\HostComponents.config" XPath="/HostComponents/Components/Component/Properties/Property[@Name='DisableMonitoring']/@Value" Value="true" />
  </Target>

我能找到的最接近的是这个帖子:

http://orchard.codeplex.com/workitem/19688

并且我已经尝试了这些建议,但它仍然失败。

有人有解决方案吗?

提前THX。

/威尔

2 个答案:

答案 0 :(得分:0)

我找到了解决方案。

请将以下路径更改为=&gt;

<UsingTask AssemblyFile="C:\Users\Shaun\Documents\@GitHub\CertifiedOverheadCrane\orchard1x\src\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll"
           TaskName="MSBuild.Orchard.Tasks.XmlDelete" />

原件:

<!--<UsingTask AssemblyFile="$(ProjectDir)\..\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll" 
         TaskName="MSBuild.Orchard.Tasks.XmlDelete" />-->

不要忘记重启VS。

答案 1 :(得分:0)

我的问题的解决方案是我只在“调试”配置中构建了项目,而我的发布选项正在寻找“发布”。所以我只在解决方案配置中将其更改为“Release”并按下 - &gt;构建/构建解决方案。那很有效!

/威尔。