This is a migrated thread and some comments may be shown as answers.

Coded step fails to complile even after assembly reference added

3 Answers 29 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nhan Ai
Top achievements
Rank 2
Nhan Ai asked on 22 Jan 2014, 08:37 PM
I am trying to add a coded step where I can write data to an Excel file.
I have added the reference in Project Settings -> Script Options -> Add reference from the location below:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client

However, when I run the test, it still fails to complile my coded step. View log displays the error as follow:

c:\Users\Nhan Ai\Documents\Test Studio Projects\Beats Automated Tests\WebTest.tstest.cs: Line 86: (CS0234) The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

And in the code Viewer, these line are highlighted.

Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook workbook = excelApp.Workbooks.Open(myPath);

Please help!
Thank you,

Nhan Ai


3 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 23 Jan 2014, 01:52 PM
Hello Nhan,

Thank you for contacting us.

This assembly is in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14 or Office12 depends on the version of your MS Office.

Note that you should add Microsoft.Office.Interop.Excel.dll.

Let me know if this helps.

Regards,
Boyan Boev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Nhan Ai
Top achievements
Rank 2
answered on 24 Jan 2014, 11:09 PM
Hi Boyan,

Thank you for the guide.
Actually I had to download Visual Studio Tools to get Microsoft.Office.Interop.Excel.dll.
And the .dll is located in C:\\Windows\assembly GAC, not in Office 14 or Office 12 folder.

I got my coded step run ok now.

Thanks,
Nhan Ai
0
Boyan Boev
Telerik team
answered on 28 Jan 2014, 07:21 AM
Hi Nhan,

I am glad to hear that!

Let us know if you need further assistance.

Regards,
Boyan Boev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Nhan Ai
Top achievements
Rank 2
Answers by
Boyan Boev
Telerik team
Nhan Ai
Top achievements
Rank 2
Share this question
or