从 VS2008 导出的项目模板但已损坏?

问题描述:

我正在使用 Visual Studio 2008 Team System 版本创建自定义项目模板.我还为自定义模板创建了一个自定义向导.

I am working on creating a custom project template with Visual Studio 2008 Team System edition. I have also created a custom wizard for the custom template.

所以我必须更新 vstemplate 文件以告诉模板使用我的自定义向导.但是存档已损坏!

So I have to update the vstemplate file to tell the template to use my custom wizard. But the archive is corrupted!

7zip 认为存档中的文件夹使用的是非标准 zip 压缩.最新的 winzip 认为文件夹上的 CRC 标头与主 CRC 标头不匹配.

7zip thinks folders within the archive are using non-standard zip compression. The latest winzip thinks the CRC header on the folders doesn't match the main CRC header.

我做错了什么?

如果我不更改 VS2008 创建的模板 zip 文件,它就可以正常工作.但我需要能够更新 zip 文件.如果我这样做,7zip/winzip 修复了 zip 文件结构,然后 VS2008 不再喜欢该模板.无法访问 zip 文件中文件夹中的文件.

If I don't change the template zip file created by VS2008, it works just fine. But I need to be able to update the zip file. If I do, 7zip/winzip fixes the zip file structure and then VS2008 doesn't like the template anymore. Files that are in folders within the zip file are inaccessible.

我确实注意到标准模板似乎保持平面文件结构.那不是嵌套文件夹或任何东西.但是 vstemplate 文件具有重新创建原始文件夹结构的 targetfilename 属性.

I do notice that the standard templates seem to keep a flat file structure. That is no nested folders or anything. But the vstemplate file has targetfilename attributes that recreate the original folder structure.

例如代替...

<Folder Name="My Project" TargetFolderName="My Project">
    <ProjectItem ReplaceParameters="true" TargetFileName="AssemblyInfo.vb">AssemblyInfo.vb</ProjectItem>
</Folder>

标准的 vstemplate 定义了以下内容...

the standard vstemplate defines the following...

<ProjectItem ReplaceParameters="true" TargetFileName="My Project\AssemblyInfo.vb">AssemblyInfo.vb</ProjectItem>

我刚刚对上述内容进行了一些思考.它们实际上是同一回事吗?

I've just had a little think about the above. Are they actually the same thing?

是原始zip文件创建的问题吗?

Is the problem with the creation of the original zip file?

zip 文件中的文件夹结构是否会导致一切问题?

Is the folder structure within the zip file tripping everything up?

它是否应该以平面文件夹结构将所有文件添加到 zip 存档中?如果是这样,是否有针对 VS2008 的修复程序,以便我不必手动修复模板存档?

Should it have added all the files to the zip archive in as flat folder structure? If so is there a fix for VS2008 so that I do not have to manually fix the template archives?

您无需将存档内容修改为扁平化.

You don't need to modify the contents of the archive to be flat.

诀窍是在编辑存档的解压缩内容之后,而不是选择文件夹并压缩它,而是打开文件夹并选择所有文件(和文件夹,如果存在),然后压缩它们.

The trick is after editing the unzipped contents of the archive, instead of selecting the folder and zipping that, open the folder and select all the files (and folders if present), and zip those instead.

这就是阻止 Visual Studio 将存档识别为模板的原因.这应该适用于 7-Zip、WinRAR 或任何您碰巧喜欢的臃肿软件 WinZip.

This is what is preventing Visual Studio from recognizing the archive as a template. This should work with 7-Zip, WinRAR, or whatever you happen to prefer to the bloatware that is WinZip.