Ian Herbert
Ian Herbert

Reputation: 1019

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.

Upvotes: 6

Views: 3054

Answers (2)

Ian Herbert
Ian Herbert

Reputation: 1019

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.

Upvotes: 4

JPBlanc
JPBlanc

Reputation: 72680

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.

Upvotes: 2

Related Questions