Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenXML Power Tools trouble compiling: 'OutputTypeAttribute' could not be found

I am using the OpenXMLSDK for some DOCX manipulation. I am trying to compile the OpenXML Power Tools source for help with this. I read that I needed to instal the MS Power Shell for this to compile (for its use of Cmdlets), so I downloaded it from here. The first option, Windows Management Framework 3.0 CTP1. I am still having problems with the OutpuTypeAttribute class. It is not available in my code. MSDN says its in the System.Management.Automation namespace, which I am 'using'. I am still getting this error message for any references to this class:

"The type or namespace name 'OutputTypeAttribute' could not be found (are you missing a using directive or an assembly reference?)".

So, does anyone know what is going on here?

BTW, I am on Windows 7 and using VS 2010.

like image 572
Ian Herbert Avatar asked Jan 17 '12 02:01

Ian Herbert


2 Answers

For some reason the C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll was an old version and it never got updated.

What I did was this: In a powershell I executed this command:

Copy ([OutputType].Assembly.Location) ~/Desktop

Then I moved the dll file that is copied to the desktop to the Reference Assemblies directory shown above. This new file is about 3mb larger than the older file. I also had to convert my project to .NET 4 because this new DLL required it.

like image 175
Ian Herbert Avatar answered Nov 01 '22 20:11

Ian Herbert


I don't know if it can help but System.Management.Automation can be referenced from two places :

For 64 bits :

C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0

For 32 bits :

C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0

I remember that I use to have a kind of similary error using one in place of the other.

like image 2
JPBlanc Avatar answered Nov 01 '22 21:11

JPBlanc