Orchard 1.7 publish error: The "MSBuild.Orchard.Tasks.XmlDelete" task could not be loaded from the assembly - asp.net-mvc-4

I have a local Orchard 1.7 cms site, which i have customized and so forth. My task is now to publish my site to my host(arvixe.com) through Visual Studio Ultimate 2012 - via the publish option. But the publish fails and i get this error:
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
by looking at the source where the error is located around line 247, in the Orchard.Web.csproj, it looks like this:
</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>
The closest ting i can find on this, is this thread:
http://orchard.codeplex.com/workitem/19688
and i have tried those advices, but it keeps failing.
Does anyone have a solution for this?
THX in advance.
/Will.

I found the solution.
Please change following path to =>
<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" />
Original:
<!--<UsingTask AssemblyFile="$(ProjectDir)\..\Tools\MSBuild.Orchard.Tasks\bin\Release\MSBuild.Orchard.Tasks.dll"
TaskName="MSBuild.Orchard.Tasks.XmlDelete" />-->
Don't forget to restart VS.

The solution to my problem was that i had only built the project in "Debug" configuration, while my publishing option was looking for "Release". So I only changed it to "Release" in the Solutions Configurations and pressed --> Build/Build Solution. That worked!
/Will.

Related

Is there any similar kind of configure to rolingStyle="once" of log4net is available for NLog?

I am using log4net currently and on every hour log file archive is being performed.
Now I am changing log4net to NLog
Is there similar setting available in NLog Like rolingStyle="once"? which was configure setting available in log4net.
For example earlier while using log4net the files created were used to be like:
LogFile.log
LogFile.log.1 <-last archive file
Following is configuration I used in log4net and I want to use the exact configure settings so that archived file naming should remains as it was in log4net:
<appender name="Work" type="RMM.Common.Logger.LogFileRollingAppender, Common">
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<dateTimeStrategy type="log4net.Appender.RollingFileAppender+UniversalDateTime" />
<file type="log4net.Util.PatternString" value="%property{EdgeAPILogPath}\WebAPI_Work.log" />
<param name="AppendToFile" value="true"/>
<rollingStyle value="Once" />
<rollingStyle value="Composite" />
<datePattern value=".yyyyMMdd-HH" />
<maxSizeRollBackups value="300" />
<maximumFileSize value="20MB" />
<Encoding value="UTF-8" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%utcdate{yyyy/MM/dd HH:mm:ss,fff} [%-5p] [%3t] %m%n" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="DEBUG" />
<levelMax value="FATAL" />
</filter>
</appender>
You can:
Use fileName="${basedir}/logs/${cached:${date:format=yyyy-MM-dd HH_mm_ss}}.log" as a way to ensure one log file per application instance.
Use archiveFileName="${archiveLogDirectory}/LogFile.log.{####}" to append numbers at the end (feel free to add or remove # as required, depending on your maxArchiveFiles).
Use archiveNumbering="Sequence" to achieve the order you want (higher numbers = newer logs).
Source: this piece of documentation and some personal experience.
Hopefully this basic example will help you getting closer to your final target:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Error"
internalLogFile="./internal-nlog.txt"
throwExceptions="true">
<variable name="logDirectory" value="./logs"/>
<variable name="archiveLogDirectory" value="./logs/archive"/>
<targets>
<target name="errors"
xsi:type="File"
fileName="${logDirectory}/${cached:${date:format=yyyy-MM-dd HH_mm_ss}}.log"
archiveFileName="${archiveLogDirectory}/LogFile.log.{#}"
maxArchiveFiles="9"
archiveEvery="Hour"
archiveNumbering="Sequence"
/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="errors"/>
</rules>
</nlog>
Not an expert on log4net, but it sounds like that rolingStyle="once" is the same as NLog FileTarget ArchiveOldFileOnStartup. So maybe something like this:
<nlog>
<variable name="EdgeAPILogPath" layout="${basedir}" />
<targets>
<target xsi:type="file" name="work"
fileName="${EdgeAPILogPath}/WebAPI_Work.log"
encoding="utf-8"
archiveNumbering="DateAndSequence"
archiveFileName="${EdgeAPILogPath}/WebAPI_Work.{#}.log"
archiveDateFormat="yyyyMMdd-HH"
archiveEvery="Hour"
archiveAboveSize="20000000"
archiveOldFileOnStartup="true"
maxArchiveFiles="300" />
</targets>
<rules>
<logger name="*" minLevel="Debug" writeTo="work" />
</rules>
</nlog>
See also: https://github.com/NLog/NLog/wiki/FileTarget-Archive-Examples

WebStorm: Exclude folders by pattern

this is how a .idea/${repo}.iml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludePattern pattern="*.log" />
<excludePattern pattern="*.lock" />
<excludePattern pattern="dist/*" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
this is a screenshot of my preferences > directories configuration:
Expected:
Being able to mark directories as excluded by pattern,
so I can ignore multiple folder at once.
(I use a monorepo and have multiple dist dirs)
Actual
Files under dist are still being indexed, even while the folder dist is marked with a different color.
using WebStorm 2019.1.3
dist should work, dist/* won't - excluding files/folders by relative path pattern is not supported, see IDEA-173675

How to add SceneBuilder to Intellij after mistakenly adding the SceneBuilder's shortcut link

So I installed Intellij for the first time and I mistakenly linked SceneBuilder's shortcut link to the FXML file and keep getting this error: IntelliJ failed to start scene builder. After doing a lot of searching, I could not find out how to reset SceneBuilder. How do I reset SceneBuilder in IntelliJ?
Go to Settings > Languages & Frameworks > JavaFX > Path to SceneBuilder and select directory of JavaFX Scene Builder 2.0.exe
I had to follow this instruction to find the files I needed to edit. -> Instructions
I use Windows 10 so I used <SYSTEM DRIVE>\Users\<USER ACCOUNT NAME>\.<PRODUCT><VERSION>. My path looks like C:\Users\yourUserName\.IdeaIC2017.3\config. Next, I searched for "scenebulder". The results lead me to a file named "options" and a file named "other".
other.xml
<application>
<component name="JavaFxSettings">
<!-- change here --><option name="pathToSceneBuilder" value="$USER_HOME$/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Gluon/SceneBuilder.lnk" />
<!-- change here --><option name="myPathToSceneBuilder" value="$USER_HOME$/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Gluon/SceneBuilder.lnk" />
</component>
</application>
options.xml
<application>
<component name="PropertiesComponent">
<property name="Default.savedEditorTheme" value="_#user_Default" />
<property name="installed.kotlin.plugin.version" value="1.2.10-release-IJ2017.3-1" />
<property name="project.wizard.group" value="JavaFX Application" />
<property name="project.wizard.template" value="JavaFX Application" />
<!-- change here --><property name="file.chooser.recent.files" value="$USER_HOME$/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Gluon/SceneBuilder.lnk
C:/Program Files/Java/jdk1.8.0_141" />
<property name="jdk.selected.JAVA_MODULE" value="1.8" />
<property name="file.gist.reindex.count" value="641" />
<property name="lastTip" value="3" />
<property name="settings.code.style.selected.tab.JAVA" value="Tabs and Indents" />
<property name="FileTemplates.SelectedTemplate" value="HTML File" />
</component>
</application>
I found where my SceneBuilder exe is located and changed the path in both files.
other.xml
<application>
<component name="JavaFxSettings">
<!-- change here --><option name="pathToSceneBuilder" value="$USER_HOME$/AppData/Local/SceneBuilder/SceneBuilder.exe" />
<!-- change here --><option name="myPathToSceneBuilder" value="$USER_HOME$/AppData/Local/SceneBuilder/SceneBuilder.exe" />
</component>
</application>
options.xml
<application>
<component name="PropertiesComponent">
<property name="Default.savedEditorTheme" value="_#user_Default" />
<property name="installed.kotlin.plugin.version" value="1.2.10-release-IJ2017.3-1" />
<property name="project.wizard.group" value="JavaFX Application" />
<property name="project.wizard.template" value="JavaFX Application" />
<!-- change here --><property name="file.chooser.recent.files" value="$USER_HOME$/AppData/Local/SceneBuilder/SceneBuilder.exe
C:/Program Files/Java/jdk1.8.0_141" />
<property name="jdk.selected.JAVA_MODULE" value="1.8" />
<property name="file.gist.reindex.count" value="641" />
<property name="lastTip" value="3" />
<property name="settings.code.style.selected.tab.JAVA" value="Tabs and Indents" />
<property name="FileTemplates.SelectedTemplate" value="HTML File" />
</component>
</application>
Finally, I restarted IntelliJ and right clicked on the FXML file and selected "Open in SceneBuilder" and it worked.
follow the below step
Download and install scenebuilder(download same version of scene builder as your Java in your machine for eg if you have Java 8 on your local then download Scene builder version 8)
1.Open intellij -> Navigate to file -> Setting -> Type JavaFx
Set the location of scenebuilder in your local machine to the path as shown below
C:\Users\userid\AppData\Local\SceneBuilder\SceneBuilder.exe
Click apply and OK.
Now try to access scene builder from your .fxml file

Check if Targets exists with MSBuild task

Here is my code:
<MSBuild Projects="outs.proj" Targets="Build;MyCustomTarget">
</MSBuild>
I need to check if MyCustomTarget exists in outs.proj before executing.
It throws an error when MyCustomTarget is not imported, so depending on the result use either Build or Build+MyCustomTarget.
Thanks in advance for your help.
Getting a list of targets is cumbersome, you can either reflect on TaskHost via BuildEngine to get current Project or re-evaluate the project with an inline task.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Targets" TaskFactory="CodeTaskFactory" AssemblyName="Microsoft.Build.Tasks.v12.0">
<ParameterGroup>
<Project ParameterType="System.String" Required="true" />
<All ParameterType="System.String[]" Output="true" />
<Run ParameterType="System.String[]" Output="true" />
</ParameterGroup>
<Task>
<Reference Include="Microsoft.Build" />
<Reference Include="System.Xml" />
<Code>
All = new Microsoft.Build.Evaluation.Project(Project).Targets.Select(t => t.Key).ToArray();
Run = Run.Where(All.Contains).ToArray();
</Code>
</Task>
</UsingTask>
<Target Name="Foo">
<Targets Project="$(MSBuildProjectFullPath)" Run="Foo;Baz">
<Output TaskParameter="All" ItemName="All" />
<Output TaskParameter="Run" ItemName="Run" />
</Targets>
<Message Text="All Targets: #(All)" />
<Message Text="Run Targets: #(Run)" />
</Target>
<Target Name="Bar" />
</Project>
Edit:
You don't provide much details so I can't help with your particular issue, but if new Project(Project) throws may be try ProjectCollection.GlobalProjectCollection.LoadProject(Project) instead to get to the Targets; the same collection has the LoadedProjects property as well as GetLoadedProjects and UnloadProject methods to play around with to get around your exception. If you're in control of the project file and it's flat with no Import you might want to try parsing it as a simple XML file rather than a fully fledged MSBuild project.
<XmlPeek XmlInputPath="$(MSBuildProjectFullPath)" Query="/p:Project/p:Target/#Name" Namespaces="<Namespace Prefix='p' Uri='http://schemas.microsoft.com/developer/msbuild/2003' />">
<Output TaskParameter="Result" ItemName="All" />
</XmlPeek>
<ItemGroup>
<In Include="Foo;Baz" />
<Out Include="#(In)" Exclude="#(All)" />
<Run Include="#(In)" Exclude="#(Out)" />
</ItemGroup>
<Message Text"#(Run)" />
In either case, you pass outs.proj path to whichever method you choose go with and get back #(All) with all of the targets in that project (Foo;Bar) then you filter your targets down from Foo;Baz to just Foo since Baz doesn't exit in #(All). Then you do whatever you want to do with this information, e.g. <MSBuild Projects="outs.proj" Targets="Build;#(Run)">.

Intellij 12 and websphere liberty 8.5 next beta - Application server libraries not found

I installed the latest WebSphere liberty profile to the Mac:
wlp-developers-runtime-8.5.next.beta.jar
WebSphere version is shown as 8.5.next.beta in Intellij.
In Intellij 12 I try to add this WebSphere Application Server and I get:
Cannot Save Settings: Application server libraries not found
If I look on the filesystem it seems that the location of:
com.ibm.ws.javaee.jsp.2.2_1.0.0.0.jar
com.ibm.ws.javaee.servlet.3.0_1.0.0.jar
has changes from /dev/spec to /dev/api/spec
I am not sure if this is the root cause, but Intellij seems to add these to the classpath in the previous version. Is there a way to get intellij up and running e.g. can I change the location where it looks for the libs?
Had the same issue. There are two ways.
Either unpack wlp 8.5 into the folder where you want to have wlp 8.5.next. Once unpacked, point IntelliJ to that folder and it will detect it. Once detected, just remove the wlp folder and unpack the 8.5.next in the same. Once done, correct the library paths.
Or; Open IntelliJ's other.xml-file (it's usually in ~/.IntelliJIDEA12/config/options/other.xml) and modify as following:
<?xml version="1.0" encoding="UTF-8"?>
<application>
<!-- other stuff -->
<component name="AppserversManager">
<LibraryTable>
<library name="WebSphere 8.5.Next.Beta">
<CLASSES>
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.annotation.1.1_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.cdi.1.0_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.ejb.3.1_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.el.2.2_1.0.1.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.interceptor.1.1_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jaxb.2.2_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jaxrs.1.1_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jaxws.2.2_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jms.1.1_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jsf.2.0_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jsf.tld.2.0_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jsp.2.2_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jsp.tld.2.2_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.jstl.1.2_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.persistence.2.0_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.servlet.3.0_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.transaction.1.1_1.0.0.jar!/" />
<root url="jar:///opt/wlp/dev/api/spec/com.ibm.ws.javaee.validation.1.0_1.0.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</LibraryTable>
<ServerDK NAME="WebSphere 8.5.Next.Beta">
<option name="SOURCE_INTEGRATION_NAME" value="WebSphere Server" />
<DATA>
<state>
<option name="home" value="/opt/wlp" />
<option name="version" value="8.5.next.beta" />
</state>
</DATA>
</ServerDK>
</component>
<!-- rest -->
</application>
This has now been officially fixed in Intelli 12.1.2 and newer. The release notes and original ticket have further details.