.NET Framework Bookmark and Share   
 index > MSBuild > MSB4018: The "CompileWorkflowTask" task failed unexpectedly.
 

MSB4018: The "CompileWorkflowTask" task failed unexpectedly.

Hi There,

I'm trying to compile a Solution with a few projects in it via MSBuild on a windows 2008 machine (32bit). THis exact same process used to work on a 2003 enterprise machine without a hitch. On 2008 it fails on a couple of places. One of them is When it tries to compile a Sequential WOrkflow task from a project.

"T:\Adm\msbuild\AppSoftware.target" (AppSoftware_All target) (1) ->
"T:\AppSoftware\App.DotNet.BuildSolution\Developer.sln" (default target) (8) ->
"T:\AppSoftware\Server\Components\BatchServicesScheduler\App.Server.Components.csproj" (default target) (71) ->
(WorkflowCompilation target) ->
C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets(127,5): error MSB4018: The "CompileWorkflowTask" task failed unexpectedly.
C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets(127,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.
C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets(127,5): error MSB4018: at System.Environment.GetEnvironmentVariable(String variable, EnvironmentVariableTarget target)
C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets(127,5): error MSB4018: at System.Workflow.ComponentModel.Compiler.CompileWorkflowTask.Execute()
C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets(127,5): error MSB4018: at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)


This runs as a scheduled task thattriggers a batch file thatSUBSTitutesa folder to a drive (T:) andcalls MSBUILD with a project (AppSoftware.target). This AppSoftwarecalls (among many other lines) the following:

<

MSBuild Projects ="$(AppSoftwarePath)\App.DotNet.BuildSolution\Developer.sln" Properties ="Configuration=$(TRG)" StopOnFirstFailure ="true" ContinueOnError ="false"/>

This Solution file has about 70 projects, all c# (WebProjects, Silverlight projects,etc).

WHen this runs on its own (from the scheduled task), that error comes up, if I run this as a logged in user (command line OR IDE) the compilation goes through.
I'm not sure what needs to be setup on the Scheduler for this not to happen. THis is how my Scheduler is setup (Which i think is right):

Author: Administrator
When RUnning task, use acct: Administrator
Run whether is logged or not (Not store password is UNCHECKED)
Run with Highest priviledges CHECKED
HIdden UNCHECKED
Configure for Windwos 2008
Action->Start Program->batchfile.bat


Did anyone have such problem or knows how canI solve this one?
THanks,
Marcelo
MarceloRamos
Hi,
It seems that the CompileWorkflowTask target inworkflow.Targets received a null variable, If you open the workflow.Targets inthe notepad, you can see the WorkflowCompilation target which contains the CompileWorkflowTask. And in the task, you can find all the input parameters required.
I have invested your problem and I foundanother guy have the same problem with you, and he fixed the problem by replacing the $(MSBuildBinPath) by the $(MSBuildToolsPath) in the *.csproj file.
Please try this, if this could not resolve your problem, please feel free to let me know.
Thanks
Chao
Chao Kuo

You can use google to search for other answers

Custom Search

More Threads

• Using PREfast in an automated build process
• Post event for the entire build process.
• MS Build targets for C# 1.1
• Exited with some error codes
• How to update Msbuild
• Can I use MSBuild to automate the build of Integration Services or Analysis Services project?
• Build Error I Can't Find: <%@ MasterType TypeName="ggg.Web.Main" %>dll". Illegal characters in path.
• Error CS0234 on building web based application using Team Build
• Error when invoking MSBuild from command line
• VS2005 rebuild for "up-to-date" projects