Build Error After Migrating Process to Windows Compatibility – System.Linq.Expressions Version Conflict

I recently migrated one of my older UiPath RPA processes from the legacy (Windows - Legacy) compatibility to the new Windows compatibility. After the migration, I’m encountering a build error when trying to run or publish the process.

What I’ve tried:

  • Cleaned and rebuilt the project.
  • Updated and downgraded Newtonsoft.Json to see if it would resolve the issue.
  • Removed and reinstalled packages.
  • Tried deleting project.json and regenerating it by reopening the project. And adding all needed packages for the project manually.
  • I’ve also tried the project on a different machine, to figure out if my nuget config is wrong. It did not work there either

Error message:

Unexpected error has occurred during the library compilation process:
The assembly compilation returned the following errors:
 * warning CS1701: Assuming assembly reference 'System.Linq.Expressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' used by 'Newtonsoft.Json' matches identity 'System.Linq.Expressions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' of 'System.Linq.Expressions', you may need to supply runtime policy

This is my dependencies:

Still getting the same error during build. Has anyone else encountered this after switching to Windows compatibility? Any tips on how to fix this version conflict? Thanks in advance for any suggestions :folded_hands:

  1. Make sure UiPath Studio and the following packages are updated to their latest Windows-compatible versions

or

  1. Create a new Windows-compatible project:
  • Copy over your Main.xaml and other workflows
  • Reinstall only the required packages in the new project
  • This often works when other methods fail due to hidden legacy configs

Hey @Adrian_Vigdal
When you migrate from Windows - Legacy (.NET Framework) to Windows (.NET 6/7/8), your project moves from a traditional .NET Framework base to the modern .NET Core/.NET 6+ base.

The Newtonsoft.Json library (which you’re using or is used by another dependency) was built against an older version of System.Linq.Expressions (v6.0), but in your current project, .NET 8’s version (v8.0) is being used.

Try setting Newtonsoft.Json to version 13.0.3, which is the most compatible with .NET 6+:

  • Go to Manage Packages > All Packages
  • Search for Newtonsoft.Json
  • Set version to 13.0.3 (or latest stable supporting .NET 6/7)
  • Rebuild the project
    cheers

My solution is using Newtonsoft.Json to version 13.0.3

Made a new Windows-compatible project now, copied all the .xaml files manually, installed only the needed packages and got the same error.

From the screenshots and error messages, the issue you’re facing is a version conflict between Newtonsoft.Json and System.Linq.Expressions.

Error Summary

The compiler is throwing errors like:
warning CS1701: Assuming assembly reference ‘System.Linq.Expressions, Version=6.0.0.0 …’ used by ‘Newtonsoft.Json’ matches identity …

This usually happens after migrating a project to the Windows compatibility mode in UiPath and when there’s a mismatch in dependent library versions.

Steps to Fix the Error

  1. Update All Dependencies to Latest Stable Versions

Make sure you’re using compatible versions. You can do this from Manage Packages in UiPath:
• Newtonsoft.Json → Try downgrading it to 12.0.3 (recommended and widely supported in UiPath).
• Ensure your .NET compatibility in the project matches the dependencies. UiPath (Windows projects) typically works well with .NET 6.

2. Check Target Framework

Open project.json file and ensure you have:

“runtimeOptions”: {
“targetFramework”: “net6.0-windows”
}

If it’s not set or you’re using legacy dependencies, you’ll get runtime conflicts.

  1. Clean Project Cache
    • Close UiPath Studio
    • Delete the project.json.local file (if it exists)
    • Reopen the project

    4. Remove and Re-add Conflicting Packages

OK, so the downgrading did not work. Deleting project.json didnt work.

But, the editing of project.json file did give me another error when trying to open the project itself!

24.10.7+Branch.support-v24.10.Sha.6d3438b19dcc48ef32eec5882f6545fcded7b33a.6d3438b19dcc48ef32eec5882f6545fcded7b33a

An internal error has occurred. It is recommended to restart UiPath Studio.

Open Document Error: UiPath.Studio.Contracts.RecoverableException
 ---> Newtonsoft.Json.JsonSerializationException: Error converting value "net6.0-windows" to type 'UiPath.Shared.TargetFramework'. Path 'targetFramework', line 67, position 37.
 ---> System.ArgumentException: Requested value 'net6.0-windows' was not found.
   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber)
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject[T]()
   at UiPath.Project.ProjectData.WorkflowDataUpgrade.<>c.<.ctor>b__3_0(JObject projectJson)
   at UiPath.Project.ProjectData.WorkflowDataUpgrade.GetLatestProjectData(String projectContent)
   at UiPath.Project.WorkflowProjectRepository.<>c__DisplayClass10_0.<Read>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at UiPath.Project.WorkflowProjectRepository.Read(String path, Dictionary`2 availablePackages)
   at UiPath.Studio.Plugin.Workflow.Project.ProjectJsonReader.ReadAsync(String path)
   at UiPath.Studio.Core.Services.PersistableServiceBase`3.GetFactoryByPath(String path)
   at UiPath.Studio.Core.Services.PersistableServiceBase`3.ResolveFactory(OpenInformation openInfo)
   at UiPath.Studio.Core.Services.PersistableServiceBase`3.OpenAsync(OpenInformation openInfo)
   at UiPath.Studio.Core.CommonServices.ProjectServiceBase.OpenAsync(OpenInformation openInfo)
   at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenProjectInternal(OpenInformation openInfo)
   at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenProjectFromFileLocationAsync(OpenInformation openInfo)
   at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenDocumentAsync(OpenInformation openInfo)
   --- End of inner exception stack trace ---
   at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenDocumentAsync(OpenInformation openInfo)
   at UiPath.Studio.Core.CommonServices.OpenCloseCommandsService.OpenPath(String filePath, String openProjectOrigin)
   at UiPath.Studio.Shell.Services.ProcessArgumentsService.ProcessWithCommandLine(String commandLineFileName, String openProjectCallOrigin)
   at UiPath.Studio.Shell.ShellApplication.StudioShellApplication.<>c__DisplayClass29_0.<<OnMainWindowLoaded>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler), HResult -2146233088

Have you tried to restart studio?
@loginerror might help you on that ..

Yes, of course i’ve tired that :laughing:

could you check that link hope it help

Honestly? If you haven’t done so yet, file a support ticket.

In the meantime you can also try clearing your nuget cache and/or trying on a fresh VM/different environment. But this looks a bit like an internal resolution error, especially on something so common as Newtonsoft, so it’ll be pretty hard to “guess your way around this”. The most efficient way will be to poke around with someone from the Studio team on the call.

For context - we’ve migrated a ton of processes from legacy to windows, many using Newtonsoft (directly or through custom dependencies) in various different versions, and I’ve never seen this error appear.

Hi @Adrian_Vigdal,

I would try to avoid having these dependencies installed standalone:
image

The debugging steps I would take in this scenario would be from two directions:

  • try to purge a copy of this process down to pure dependencies only and see if it works then.
    • if not, use the “Remove unused imports” option and try again.

And the other direction would be to:

  • create a new project with the same dependencies, and copy over the XAML files one by one to see the point at which it will stop compiling.

We are happy to investigate it closer, and as suggested above - a support ticket is a good place to start for this issue. We want to make the conversion from Legacy to Windows as reliable as possible.