我已经在两台不同的机器上进行了尝试,并尝试了几次下载,但每当我尝试在VS2010Premium(10.0.30139.1VSIX)中安装生产力工具扩展时,我都会收到错误消息“该文件不是有效的RTMRel包”。搜索发现只有一两个人遇到过这个问题。我该如何诊断这个问题呢?
编辑:为了响应Aaron的建议,我运行了下面的代码,结果如下:
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.ZipIOLocalFileBlock.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我已经下载了该文件几次,每次都有相同的结果,这表明我的文件系统或Packaging库存在一些不同或错误的地方。
发布于 2011-03-30 00:12:07
我是为Visual Studio2010编写VSIX/扩展管理器的团队中的一名开发人员,所以也许我可以在这里提供帮助。VSIX文件是一个OPC容器(基本上是一个带有一些额外约束的zip文件)。如您所料,我们使用托管OPC来打开文件(即.NET中的System.IO.Packaging命名空间)。只有在调用ZipPackage.Open失败时,才会出现此错误消息。
您是否可以尝试在您的机器上将以下代码编译成C#控制台应用程序(以.NET 4.0为目标),并查看结果?您还需要添加对WindowsBase的程序集引用。如果这里有bug,我们当然想了解更多!
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();
}
}
}发布于 2011-03-16 17:17:36
.VSIX文件实际上是一个.ZIP文件。试着给它重命名,看看里面有什么。也许这只是一个损坏的下载问题?我自己尝试过这个链接http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/,它似乎工作得很好。
https://stackoverflow.com/questions/5323079
复制相似问题