lundi 30 novembre 2015

Microsoft Excel cannot open or save any more documents on Unit Test

There are a lot of posts about this, but with asp.net, I have checked them, but I couldn't find anything that worked for me.

There is a test in our application that access an excel file, like this:

Excel.Application _excelApp = new Excel.Application { Visible = false };

// get a new workbook
_workbook = _excelApp.Workbooks.Add(Missing.Value);

And it fails with the following error at the line where tries to add a new Workbook:

Test method MyNamespace.MyTestMethod threw exception: System.Runtime.InteropServices.COMException: Microsoft Excel cannot open or save any more documents because there is not enough available memory or disk space.

• To make more memory available, close workbooks or programs you no longer need.

• To free disk space, delete files you no longer need from the disk you are saving to.

This error makes no sense since the disk has plenty of space. Our build "server" is running Windows 7, TFS launches the builds through the Network Service User. Every other test works perfectly, we are just having issues with the ones trying to use excel.

I think this is an issue of access rights, but what access could the NetworkService user be missing to make this work?

Aucun commentaire:

Enregistrer un commentaire