How to set the name space and assembly references for Uipath File

Hi,
I am trying to set the required namespaces and Assembly references for microsoft operations to work in my external code using invoke code activity.
After I set manually the references and namespaces , they disappear everytime after we run the bot or edit the activity.So we need to set them again everytime time before we run.

Steps to reproduce:

  1. open any project/xaml file in notepad.
    2.For eg : add <x:String>Microsoft.Office.Interop.Excel</x:String> under
    <TextExpression.NamespacesForImplementation> and
    xmlns:moie=“clr-namespace:Microsoft.Office.Interop.Excel;assembly=Microsoft.Office.Interop.Excel” in the namespaces.
    3.After we save and run the bot, execution is successful.
  2. Now open the same xaml file in notepad , the references are missing.

I would like to know if there is anyway to achieve the above process as a one time process instead of doing it manually everytime.

Note: I am using a Community Version in Uipath.

1 Like

@Abhishek_sharma Why can’t you use Imports namespace functionality which is available in the bottom corner of the UiStudio.

@sathishkumar191991- Thank you for the suggestion.I have already used this import option as you have mentioned but i keep getting the error as shown in image.(This is bcoz , the name space gets disappeared after every execution/edit causing the error)

1 Like

Hey @will you share your .xaml?

@vvaidya- Yes I have added the above assembly manually , after checking your suggestions in other posts.
But this particular line from Namespaces " xmlns:moie=“clr-namespace:Microsoft.Office.Interop.Excel;assembly=Microsoft.Office.Interop.Excel" disappears after execution/edit (be it successful execution or Failed).
After I add the above namespace manually , i will be able to execute the workflow.

1 Like

@aksh1yadav : Sorry, As a new user I am not allowed to upload any files.Any other way to share ?

@Abhishek_sharma
You mean to say that the corresponding assembly is missing ?

I think @vvaidya Solution works fine. Even I tried in a sample project it is working fine.

Hey @Abhishek_sharma

As per last conversation i guess you are now able to resolved it. Am i right?

Regards…!!
Aksh

Hey thanks @aksh1yadav. Yes It is working now, the issue got resolved. I had not declared the objects/variables in a proper format i.e. using the arguments tab. Remaining is the same adding the required assembly reference.

@Abhishek_sharma, I’m still facing similar issue. Reference added manually in the xaml file keeps on getting removed on saving workflow. I have all the arguments set properly. Any guess?

2 Likes

Hey,

Did you get any solution to this? I am facing the same problem.

Go to Manage Packages and install the Microsoft Office Interop Excel, as shown in the picture.

You can see the same in the imports TAB of your UiPath Studio once its added.

2 Likes

@Abhishek_sharma

Please add a new variable to the Workflow of the type (Microsoft.Office.Interop.Excel).

please like and accept solution if it works for you.

1 Like

Many Thanks!!
I met the similar issue with assembly.
So I followed your solution and then works!