"log-"+ Now.ToString(“dd-MM-yyyy”) + ".txt" throws error

The code line in the subject throws an error: To execute this expression activity type “VisualBasicValue`1” it is required to compile. Assure, that this workflow is compiled.

This is the first line of the project, so I dont see any obvious user created problem.

The original german version of the error is: Assign: Zum Ausführen des Ausdrucksaktivitätstyps “VisualBasicValue`1” ist eine Kompilierung erforderlich. Stellen Sie sicher, dass der Workflow kompiliert wurde.

It is not showing error to me


For me it fails in an assign activity. If I use a variable and put the code in there, it also works flawlessly. At least till I get to a append file activity with the following line as text: System.DateTime.Now.ToString(“hh-mm”), where it then just runs indefinitely without writing anything in the file (tryed to upload a picture of it, but apperently it uploads the picture and then just vanishes)


you can use like that


You can’t use like that because later in the code if you need that filename again, Now might return a different value.

You almost always want to assign a dynamic date-based filename to a variable then use that variable.

Show us your Assign activity. Post a screenshot (just paste it into the reply box here).

Apparently my chrome is not capable of uploading pictures, a different browser worked

(“log-”+ Now.ToString(“dd-MM-yyyy”) + “.txt”)
This is my first activity in the project, where it just gives me an “has to be compiled” error, the one from the main post.

If I just do the assign in the variable itself, then that at least work (I can see, because the file is created). A first append then works.
The second append then is this one:
With that one it just runs indefinitely and does not write into the file, so I think the System.DataTime.Now… is the culprit.

On searching the group for “assure that this workflow is compiled” I easily found this post:

I’m guessing you have your project set to Windows instead of Windows Legacy, and don’t have the proper version of .Net installed.

I actually also found that post, but just scimmed it and didnt get that fact. Well, now I feel dumb ^^. Will try that. Will have to figure out, how to convert my project to legacy though.


That trick sadly does not work for me and the project threw a plethora of errors in my face, when I tryed to open it with the mode just changed.

I’m not surprised. The difference between Windows and Windows Legacy is probably buried quite deep.

By the way, don’t do

LogFileLocation + LogFileName

This opens you up to incorrect paths if there is no backslash on the end of LogFile Location.



thats a quite nice little trick there, will implement it directly after I fixed the legacy problem

1 Like

one should probably know the ins and outs of visual basic to use UIPath effectively (Or the C dialect that is the alternative language)

Yes, I’ve learned a lot of vb as I’ve learned UiPath. Unless you’re in C# mode, what you’re really doing is writing VB code, the activities just hide it behind a visual layer. If you were so inclined, I think you could write your entire automation in vb using the UiPath libraries.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.