Visual-studio – Exported Project Template from VS2008 but it is corrupted

visual-studio-2008

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.

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

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.

What am I doing wrong?

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.

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.

For example instead of…

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

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?

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

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

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?

Best Answer

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.

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.