Saturday, January 5, 2013

Project Server 2010 Workflow - appSettings

If you are using custom workflows in Project Server 2010 like BranchingWorkflow from Codeplex or DM Dynamic Workflow from Microsoft, you can customize it in way that suits you by altering their source code.

But, the problem is that you can't set an application setting in config file and read that setting from workflow. If you try to read app setting from your code like this:

string _var1 = System.Configuration.ConfigurationManager.AppSettings.Get("MySetting");

it will always return null.

 Workflow doesn't read Sharepoint's application pool config file.

It read from another config file; Microsoft.Office.Project.Server.Queuing.exe.config, and it is located in:
C:\Program Files\Microsoft Office Servers\14.0\Bin

But, if you try to add your appSetting there, you will still get null as a result.

So, where is the actual config?

It is called machine.config and it is located in:

In that file, you can add your app setting like this:

        <add key="MySetting" value="MyVar" />

and read it from workflow code:

string _var1 = System.Configuration.ConfigurationManager.AppSettings.Get("MySetting");

Now, _var1 will have value  "MyVar".


There is a better way of reading values from Application Settings of Web Application then messing with machine.config. More about it in this post.


  1. Hi
    I have added the guid values into machine.config as well but it did not work. I am getting this error in workflow while building solution.
    Error 1 Could not create activity of type 'EngWorkflowSolution.Workflow1.Workflow1'. System.ArgumentNullException: Value cannot be null.
    Parameter name: g
    at System.Guid..ctor(String g)
    Can you advise on this?

    1. It is hard to see where the error is without the code or some extensive description of what are you trying to do. But, if you get this error on build, then it has nothing to do with machine.config. Values from config files are read at workflow execution, not build. Maybe you should put guid values in activity properties. Maybe this link can help: