I have my project set to .NET Framework 4.0. When I add System.IO.Packaging
, it says that it doesn't exist. It also doesn't show up when I try to add it as a reference to the project.
How can I add System.IO.Packaging
to my C# project?
I have my project set to .NET Framework 4.0. When I add System.IO.Packaging
, it says that it doesn't exist. It also doesn't show up when I try to add it as a reference to the project.
How can I add System.IO.Packaging
to my C# project?
You need to add a reference to the WindowsBase.dll. System.IO.Packaging is located in there.
See this article for more details:
http://msdn.microsoft.com/en-us/library/system.io.packaging.package.aspx
For a C# solution in Visual Studio 2010 with .NET 4.0:
Save the solution (especially if you're compiling from the command-line with MSBuild) and you should now be able to add the using System.IO.Packaging directive to the top of your .cs file without an error appearing.
The
System.IO.Packaging
namespace is provided byWindowsBase
. When you add a reference, addWindowsBase
as the reference instead of trying to findSystem.IO.Packaging
.In my case I was using a ashx handler. For it to work you need to add the assembly to the project and the handler:
This finally worked for me, tried multiple times to add WindowsBase as reference(restarted VS, restarted machine too) but still it was not working till I added this explicitly in my aspx page. I used:
<%@ Assembly Name="WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
as the dll i had referenced was version 4.0.System.IO.Packaging v4.0.30319 is in WindowsBase.dll v4.0.30319
For windows 10 maybe you could found here
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\
We can add WindowsBase.dll in Dot Net framework 3.5 as well. I am using XP machine and Path for WindowsBase.dll is
Example for using
System.IO.packaging
is given here -Using System.IO.Packaging to generate a ZIP file