Script components return validation errors after upgrading Workflow to 8.0
search cancel

Script components return validation errors after upgrading Workflow to 8.0

book

Article ID: 164688

calendar_today

Updated On:

Products

Workflow Solution

Issue/Introduction

After upgrading from Workflow 7.6 to 8.x. and attempting to use use a Workflow or process that contained the  "Code (Script) Component", a error is generated during project validation. 

Script Error:The type or namespace name 'Script' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

Environment

Workflow 8.0.x

Cause

Microsoft changed some of the namespace definitions from .NET 3.5 into .NET 4.0. 

Resolution

To resolve, simply add the "System.Web.Extensions" library to your project, using the "Import Components" option, and then browse to the location of the library.  A copy can be found in the GAC, in the GAC_MSIL folder.  Once the library was added, and the project was reloaded, everything worked as expected.
Further research showed that the library does exist in .NET 4.5 or 4.6.  The appropriate library is System.Web.Extensions.dll for the method "JavaScriptSerializer().Serialize();.  On a test server, the dll file was found at ...Windows\Microsoft.NET\Framework64\v4.0.30319.  

For reference:

  • http://stackoverflow.com/questions/7000811/cannot-find-javascriptserializer-in-net-4-0 - documenting the problem
  • www.newtonsoft.com/json/help/html/JsonNetVsDotNetSerializers.htm - Replacement serializers for .NET 4.0