简体   繁体   中英

Visual Studio 2012 Can't find templates

After installing Visual Studio 2012 RTM on top of Visual Studio 2012 RC and creating a new ASP.Net Empty Web Application project, I am unable to add a New Web Form to my project. When attempting to add a new Web Form, I receive the error message:

Could not find a part of the path ....\\WebForm.zip\\WebForm.vstemplate

This problem is listed on the connect site here:

https://connect.microsoft.com/VisualStudio/feedback/details/758581/could-not-find-itemtemplate-path

I can't register the workaround there, so I'm going to do it here, so hopefully someone else can find this. (Anyone know why the d@mnded register link doesn't work?)

Update: I had to do this for the Class template also: (My path)

 C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\ide\ItemTemplatesCache\web\csharp\1033\Class
Copied the Class folder and renamed it Class.zip

.

To workaround this issue:

  1. Open an explorer window to the path. In my case the path is C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\ide\\ItemTemplatesCache\\web\\csharp\\1033

  2. Make a copy of the WebForm folder and name the copy WebForm.zip.

  3. Try to add a new web form to the project. It should succeed this time.

Try devenv /installvstemplates It worked for me. #vs2010

Chris' workaround did not work for me; but after resolving a path difference between his path and mine, it did work! Thanks Chris!

First, what I tried and the result:

The path given in Chris' workaround existed on my machine as did the WebForm folder in that path so I dutifully followed Chris' instructions:

  1. I copied and pasted the WebForm folder back into the 1033 folder (I'm using Windows 7 so copying and pasting in the same folder results in a 'WebForm - Copy' folder being created).
  2. I renamed the folder to 'WebForm.zip' per Chris' instructions.
  3. I then tried to add a new WebForm to my project and ...

Same error as before!

What I noticed, what I then tried, and the result:

Chris gave me a clue when he stated:

In my case the path is C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\ide\\ItemTemplatesCache\\web\\csharp\\1033

I decided to take a closer look at the path shown in my error dialog. Here is the error message and path I had:

Could not find a part of the path C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\ItemTemplatesCache\\CSharp\\Web\\1O33\\WebForm.zip\\WebForm.vstemplate.

Notice that CSharp\\Web in my path differs from web\\csharp in Chris' path. I would have thought Chris had made a typo in reproducing his path but both paths exist on my machine! Wha...?!

So having found this new folder after leaving the decoy behind (I'm sure that was the right path for Chris and others), I tried Chris' workaround again in this other folder and everything worked beautifully.

I am floored that there is such duplication in the Visual Studio file structure but, hey - why did I get this error in the first place?

This is very frustrating. It is looking for a .zip folder.

The quick fix I used was to just copy all directories in whatever template folder it was complaining about and add a .zip to the end. Xcopy lets you do this efficiently. I had to do this a few times as VS uses a number of different locations for templates.

Open a console here: C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\ItemTemplatesCache\\CSharp\\Web\\1033

If you navigate to one folder up (ie Web) and Shift+Click on the 1033 folder you get the option to "Open command window here"

Run this to rename all folders to folder.zip

for /d %d in (*.) do ren %d %d.zip 

Had also nasty problem with it

This workd for me copied the file to C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE>

run in cmd the command:

C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE>vsixinstaller /s :premium /v:11.0 dnntemplates.vsix

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM