Why is the Zipfile function not working?

Asked

Viewed 100 times

3

I found a function on MSDN that I’m needing to use for a program that I’m doing. My problem is that when I try to use it, it appears as if it didn’t exist in C#, remembering that I have already added the using System.IO; to the top of my program. It is necessary to make some reference to use it?

static void backup(string path)
{
    ZipFile.CreateFromDirectory(Directory.GetCurrentDirectory(), path);
}

Error:

CS0103 error The name "Zipfile" does not exist in the current context

  • We need to know what’s going on, how’s the code.

  • 3

    @bigown How is not clear enough if James managed to answer me accurately?

  • Because he gave a good kick. His answer is probably correct. But in the question there is no information indicating well what was happening. If someone else comes here they won’t be helped because you don’t know what the problem is.

  • @bigown Ready, added more information, can take the marking now?

  • Yes, now it’s okay, if everyone did it like this, it would be easy, wouldn’t it? It helped me a lot in my next post on the goal :)

  • 1

    I’m not going to argue, but the right answer is just @bigown, in case he didn’t give the answer, it’s a guess or he’s wrong. Or if the question is not at his level it is of low quality and is closed. Unfortunately we mere mortals can not do anything against it.

  • @Tiagos I said the opposite of what you are saying. I gave over 1000 answers from C# and .NET. Is any answer from me good? Or have I made a mistake in (almost) all of them? To fail to vote in the answers of others is to say clearly that only the answers themselves are good.

  • 1

    @Tiagos It is a matter of usefulness of this post. The site is not here to provide support to anyone. It’s meant to help with specific problems, but it’s meant to be useful to other people as well... The question in its original form was not clear and its answer (although certain) was a kick.

Show 3 more comments

1 answer

2


You need to add the reference System.IO.Compression.FileSystem in your project

Source: MSDN

Browser other questions tagged

You are not signed in. Login or sign up in order to post.