0

I have a VS2013 vb.net project.

I am wishing to use zip library. I have these two references set:

enter image description here

I have the following code:

enter image description here

Everything is set to .net 4.5

Is there some way to “force” VS2013 to recognize the compression libraries? There are HUGE NUMBERS , if not MASSIVE examples of this question on the internet!!! They are ALL EXACLTY the above exact same question on the internet and in EVERY CASE they suggest to reference the above 2 4.5 libraries and the problem goes away.

However, NONE of the existing questions on the internet don’t follow up WHEN the above references ARE set, and we still have a type failure!!!

Failure occurs if I set the project to 4.51, or .net 4.5

VS2013, vb.net.

I do have the project forced to x64, but changing to x32 did not change anything.

Edit: The above example code is placed in a asp.net App_Code folder (a web project). I note that if I pull the code out of that folder and place the code directly in say a form (aspx.vb), then the code DOES work. So the restriction or issue is App_Code. I have a result changed the title and added "when in App_Code folder).

Ideas anyone?

Albert D. Kallal
  • 42,205
  • 3
  • 34
  • 51
  • Just did a File|New Project and worked as expected. Try doing the same and diff the proj files? Otherwise maybe something is messed up on your machine? – David Gardiner Feb 23 '15 at 04:33
  • Hum, I created a blank web project, and the problem remains IF the code module is placed inside of App_code. If I place the code say in a web forms aspx.vb module, then it works. So I guess I “could” change the question as how one can use the Zip libraries for code inside of an App_Code folder? (the module in question is set to compile). – Albert D. Kallal Feb 23 '15 at 05:36
  • I tested just with a VB Console app – David Gardiner Feb 23 '15 at 05:44
  • Yes, as noted, EVEN the existing application works. the "problem" is that WHEN the code is placed inside of App_Code, it will not work nor compile. As noted, perhaps I should re-word the question to reflect the fact that the code ONLY breaks when placed inside of App_Code. – Albert D. Kallal Feb 23 '15 at 06:20

2 Answers2

2

Same problem... Solved adding manually the references

<add assembly="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />

in the web.config

<system.web>
  <compilation>
    <assemblies>
      <add assembly="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      <add assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    </assemblies>
  </compilation>
<system.web>

I hope it work for you too :D

Berry
  • 31
  • 5
  • Indeed this is the correct answer! The simple issue is if you create a .net Project as opposed to a web site, then code in the APP_FOLDER does NOT receive and correctly inherit the project references. The solution is to re-name the APP_FOLDER to something else, or add the references DIRECTLY into the web.config file AS YOU HAVE DONE!. So your answer is correct and the ONLY ONE that addresss this issue. The issue of course is APP_CODE folder. – Albert D. Kallal Mar 19 '15 at 02:52
2

Check the references about compression

see references

FelixSFD
  • 6,052
  • 10
  • 43
  • 117