首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试为Visual Studio 2010安装Productivity Power Tools时出错

尝试为Visual Studio 2010安装Productivity Power Tools时出错
EN

Stack Overflow用户
提问于 2011-03-16 17:12:51
回答 2查看 2.1K关注 0票数 2

我已经在两台不同的机器上进行了尝试,并尝试了几次下载,但每当我尝试在VS2010Premium(10.0.30139.1VSIX)中安装生产力工具扩展时,我都会收到错误消息“该文件不是有效的RTMRel包”。搜索发现只有一两个人遇到过这个问题。我该如何诊断这个问题呢?

编辑:为了响应Aaron的建议,我运行了下面的代码,结果如下:

代码语言:javascript
复制
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库存在一些不同或错误的地方。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 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,我们当然想了解更多!

代码语言:javascript
复制
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();
        }
    }
}
票数 4
EN

Stack Overflow用户

发布于 2011-03-16 17:17:36

.VSIX文件实际上是一个.ZIP文件。试着给它重命名,看看里面有什么。也许这只是一个损坏的下载问题?我自己尝试过这个链接http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/,它似乎工作得很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5323079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档