- Home /
I need to use the System.IO.Package namespace but keep getting complaints from Unity3D.
I am attempting to use the System.IO.Package namespace in my project (there's a good reason for needing it, but I'm not allowed to explain the details about it here). I've added a .Net reference to WindowsBase.dll (C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\.NETFramework\\v4.5\\WindowsBase.dll). The only thing I added to the default stubbed code is a using statement for System.IO.Packaging:
using System.IO.Packaging;
So, after adding the WindowsBase.dll assembly reference, MonoDevelop builds fine - no errors. But upon returning to the Unity3D window, Unity continues to report a build error: "error CS0234: The type or namespace name Packaging' does not exist in the namespace
System.IO'. Are you missing an assembly reference?". I am quite new at all this, and have Googled this to no end and reached no joy. I need some help from someone to understand if it is at all possible to use the System.IO.Package namespace, or if someone has an idea for a workaround. My end goal is to use Open Packaging Conventions to handle OPC packages of specialized, custom data.
Anyone have any thoughts or ideas about how to leverage/use OPC in a Unity project?
Any help would be appreciated! Thx.
Warmest Regards, Scott
Please, does anyone have a suggestion? Has anyone ever had to add some kind of .Net assembly reference like this to their C# $$anonymous$$onoDevelop session and has had success with it?
Please, I've run out of ideas and could use some great $$anonymous$$ds to help me out. It would be much appreciated!
Answer by Dracorat · Nov 03, 2013 at 04:34 PM
Unity runs on the .Net 2.0 framework and the namespace you want runs on 3.0 and higher. You can't import it - it's not possible.
You'll have to find a third party .Net 2.0 compatible library instead.
If you are just unzipping some basic .zip formats, you can use this namespace: System.IO.Compression.GZipStream
But if they get complex, it'll fail. In that event, you'll have to find a third party solution.
Thanks Dracorat. Pretty much the conclusion I was co$$anonymous$$g to also. Do you think Unity3D will move to a .Net version > 2.0 anytime soon?
I might also explore using the OpenX$$anonymous$$L JavaScript API, or see if there are some Boo libs out there that I could hack a solution out of. I have no clue if those are even an viable options, but guess I should check them out to make sure.
Thanks Dracorat for spending some of your time answering my question. Your suggestions are very much appreciated.
I think people will have to show a real desire for it before they do. You should drop a comment in their inbox. (Use the feedback link above) That way you add one "vote" to the tally.
I was wondering if you were able to use an OpenX$$anonymous$$L SD$$anonymous$$ with Unity. I am trying to do the same thing. Thanks!
Answer by DaveA · Nov 03, 2013 at 03:55 AM
Edit/Project Settings/Player, Other Settings, change '.Net 2.0 Subset' to '.Net 2.0'
Thanks for the suggestion DaveA. I changed that setting as you said, but unfortunately I'm still getting the same result. I was really hopeful that would fix it, but it seems it didn't. Thanks again for the suggestion though. I thought I had dug all through the settings but still managed to overlook that one somehow. I wish the change from subset to full would have fixed it though. $$anonymous$$aybe it's a version issue? WindowsBase doesn't come in anything earlier than .Net 3, as far as I can tell, but like I said ... I'm the least knowledgeable person on the planet when it comes to all this stuff.
Anyway, thanks for trying to help me out.
Your answer
![](https://koobas.hobune.stream/wayback/20220613121129im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
HashTable could not be found 1 Answer
Pragma downcast on getcomponentsinchildren 1 Answer
Swap code with DLL, component reference lost 0 Answers
How to keep helper classes with missing reference in project? 0 Answers
Missing Component Error 1 Answer