Vincent F
Vincent F

Reputation: 371

dnu restore fails on mac

I download visual studio code for mac today. I tried to create a simple asp.net 5 web application following these instructions https://code.visualstudio.com/Docs/ASPnet5

When I open my web application folder in visual studio, it says I need to run a restore command.

I ran the dnu restore command just like the instructions tell me but it seems to always fail.

I receive different errors every time I run it. But most of them are like this one:

CACHE https://www.nuget.org/api/v2/package/System.Threading/4.0.10-beta-22816 SharpCompress.Common.ArchiveException: Could not find Zip file Directory at the end of the file. File may be corrupted. Restore failed

There is a stack trace as well, but for brevity sake I'll omit it for now

Has anyone experienced this?

Upvotes: 2

Views: 2352

Answers (1)

jdasilva
jdasilva

Reputation: 616

Try dnu restore --no-cache.

You may also need to remove previously downloaded files - check ~/.dnx/packages. I removed all files from that folder some time before trying the above. Also, see the comments below, if ~/.dnx/runtimes contains unexpected versions removing them may also work. Note that the current runtime version can be controlled using dnvm.

I never saw the NullReference exception, but I was getting the SharpCompress.Common.ArchiveException. I suspect there was a mismatch from what dnu thought was the cache state with the actual cache state (maybe something timed out the first time or something).

Upvotes: 2

Related Questions