locked
NullReference exception on compiling Workflow projects

    Question

  • Hello,

     

    Trying to get the Sharepoint 2007 SDK going to make some custom workflows I ran into a strange workflow problem. I get a NullReference exception when I try to compile a sequential or statemachine workflow project (just added a new project and hit build). This happens when I make a new Sharepoint workflow project or an ordinary Windows workflow project.

     

    So I deinstalled the Sharepoint SDK, reinstalled the .NET 3.0 Framework and Visual Studio Extension for WWF, but the problems stays.

     

    I searched this site (and others) but except for a few hits (with this error but for different reasons like DirectoryNotFound) I found no similar problems or solution.

     

    My msbuild output looks like this (runned from a Visual Studio command prompt window):

            Target WorkflowCompilation:
                C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets(80,3): error MSB4018: The "CompileWorkflowTask" task failed unexpectedly.
                C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets(80,3): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.
                C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets(80,3): error MSB4018:    at System.Environment.GetEnvironmentVariable(String variable, EnvironmentVariableTarget target)
                C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets(80,3): error MSB4018:    at System.Workflow.ComponentModel.Compiler.CompileWorkflowTask.Execute()
                C:\Program Files\MSBuild\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets(80,3): error MSB4018:    at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)
    Done building target "WorkflowCompilation" in project "WorkflowConsoleApp.csproj" -- FAILED.

    Done building project "WorkflowConsoleApp.csproj" -- FAILED.

     

    It looks like some environment variable setting is missing but I don't have a clue which one that might be

    I've already deinstalled and reinstalled software but nothing helps.

     

    Delepment Environment:

    Windows 2003 Server SP1

    Visual Studio 2005 Premier Partner Edition - ENU

    Visual Studio 2005 Team Explorer - ENU

    Visual Studio 2005 Team Suite - ENU

    Visual Studio 2005 Tools for Office Runtime

    .NET Framework 3.0

    Visual Studio 2005 Extensions for Windows Workflow Foundation

    Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF)

    Sharepoint 2007

    Office 2007 Enterprise Edition (could this be a problem?)

     

    Any clues would be welcome

     

    Mike

     

    Thursday, May 24, 2007 2:41 PM

Answers

  • My problem has resolved "itself"...

    I noticed that after my de- and reinstall actions SharePoint did not function well anymore, especially the InfoPath management pages and opening InfoPath Forms in the browser gave strange errors (about not being able to access registry keys and so on). So I decided to run a repair of the SharePoint install and rerun the SharePoint Configuration Wizard. After that, SharePoint worked again.

    So I reinstalled the SharePoint SDK and guess what: I could suddenly compile the workflow projects too (Sharepoint Workflow and ordinary Workflow Foundation projects)

    Because I did not install the software myself in the first place, I think someone or something messed up the initial installation...

     

    Tuesday, May 29, 2007 5:48 AM

All replies

  • My problem has resolved "itself"...

    I noticed that after my de- and reinstall actions SharePoint did not function well anymore, especially the InfoPath management pages and opening InfoPath Forms in the browser gave strange errors (about not being able to access registry keys and so on). So I decided to run a repair of the SharePoint install and rerun the SharePoint Configuration Wizard. After that, SharePoint worked again.

    So I reinstalled the SharePoint SDK and guess what: I could suddenly compile the workflow projects too (Sharepoint Workflow and ordinary Workflow Foundation projects)

    Because I did not install the software myself in the first place, I think someone or something messed up the initial installation...

     

    Tuesday, May 29, 2007 5:48 AM
  • Had the same problem as above.

    Problem disappeared after opening "my computer" > "properties" > "advanced" > "Environment Variables" and clicking OK. I changed nothing under Environment

    Variables.

     

    The "CompileWorkflowTask" task failed unexpectedly. System.NullReferenceException > GetEnvironmentVariabele

    Monday, June 11, 2007 12:56 PM
  •  

    That worked just fine Stefan.

    Thanks

    Monday, November 10, 2008 2:13 PM
  • I dont know the reason for the problem. Earlier my workflow project used to get compiled. But all of a sudden it stopped getting compiled.

    Thanks a lot for the solution Stefan. My workflow just got compiled.

     

    Tuesday, November 23, 2010 1:17 PM