I have tried on two different machines, and tried the download several times, but whenever I try and install the Productivity Power Tools extension in VS 2010 Premium (10.0.30139.1 RTMRel), I get the error "The file is not a valid VSIX package." A search reveals only one or two other people have ever experienced this issue. How can I go about diagnosing this issue?
EDIT: In response to Aaron's suggestion below, I ran the code with the following result:
at MS.Internal.IO.Zip.ZipIOLocalFileDataDescriptor.ParseRecord(BinaryReader reader, Int64 compressedSizeFromCentralDir, Int64 uncompressedSizeFromCentralDir, UInt32 crc32FromCentralDir, UInt16 versionNeededToExtract)
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.ParseRecord(BinaryReader reader, String fileName, Int64 position, ZipIOCentralDirectoryBlock centralDir, ZipIOCentralDirectoryFileHeader centralDirFileHeader)
at MS.Internal.IO.Zip.ZipIOLocalFileBloc开发者_如何学Pythonk.SeekableLoad(ZipIOBlockManager blockManager, String fileName)
at MS.Internal.IO.Zip.ZipIOBlockManager.LoadLocalFileBlock(String zipFileName)
at MS.Internal.IO.Zip.ZipArchive.GetFile(String zipFileName)
at MS.Internal.IO.Zip.ZipArchive.GetFiles()
at System.IO.Packaging.ZipPackage.ContentTypeHelper..ctor(ZipArchive zipArchive, IgnoredItemHelper ignoredItemHelper)
at System.IO.Packaging.ZipPackage..ctor(Stream s, FileMode mode, FileAccess access, Boolean streaming)
at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess, Boolean streaming)
at System.IO.Packaging.Package.Open(Stream stream, FileMode packageMode, FileAccess packageAccess)
at VSIXReadTest.Program.Main(String[] args) in C:\\Development\\WebSockets\\PowerTools\\Program.cs:line 17
I have downloaded the file several times, each with the same result, suggesting to me that there is something different or wrong with my file system or the Packaging
library.
I'm a developer on the team that wrote the VSIX/Extension Manager for Visual Studio 2010, so perhaps I can help out here. A VSIX file is an OPC container (basically a zip file with a few extra constraints). As you might expect, we use the Managed OPC API's to open the file (i.e. the System.IO.Packaging namespace in .NET). This error message should only occur if the call to ZipPackage.Open fails.
Could you try compiling the following code into a C# console application (targetting .NET 4.0) on your machine and seeing what the results are? You'll need to also add an assembly reference to WindowsBase. If there is a bug here, we'd certainly like to know more about it!
namespace VSIXReadTest
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.Packaging;
class Program
{
static void Main(string[] args)
{
try
{
const string PathToVsixFile = @"PutPathHere!!!";
using (FileStream stream = new FileStream(PathToVsixFile, FileMode.Open, FileAccess.Read))
{
Package vsixPackage = ZipPackage.Open(stream, FileMode.Open, FileAccess.Read);
}
}
catch (Exception ex)
{
StringBuilder errorMessage = new StringBuilder();
do
{
errorMessage.Append(ex.GetType().Name);
errorMessage.Append(": ");
errorMessage.AppendLine(ex.Message);
errorMessage.AppendLine(ex.StackTrace);
ex = ex.InnerException;
} while (ex != null);
Console.WriteLine(errorMessage.ToString());
}
Console.WriteLine("Press a key to exit...");
Console.Read();
}
}
}
A .VSIX file is in fact a .ZIP file undercovers. Try to rename it and see what you have inside. Maybe it's just a corrupted download issue? I have tried this link http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/ myself and it seems to work fine.
精彩评论