简体   繁体   English

Visual Studio 2012无法找到模板

[英]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. 在Visual Studio 2012 RC上安装Visual Studio 2012 RTM并创建新的ASP.Net空Web应用程序项目后,我无法将新的Web窗体添加到我的项目中。 When attempting to add a new Web Form, I receive the error message: 尝试添加新的Web窗体时,我收到错误消息:

Could not find a part of the path ....\\WebForm.zip\\WebForm.vstemplate 找不到路径的一部分.... \\ 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 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?) (任何人都知道为什么d @mnded寄存器链接不起作用?)

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 在我的例子中,路径是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. 制作WebForm文件夹的副本并将副本命名为WebForm.zip。

  3. Try to add a new web form to the project. 尝试将新的Web表单添加到项目中。 It should succeed this time. 它应该这次成功。

Try devenv /installvstemplates It worked for me. 尝试devenv / installvstemplates它对我有用。 #vs2010 #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: Chris的解决方法中给出的路径存在于我的机器上,就像那条路径中的WebForm文件夹一样,所以我尽职地遵循了Chris的指示:

  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). 我将WebForm文件夹复制并粘贴回1033文件夹(我使用的是Windows 7,因此在同一文件夹中复制和粘贴会导致创建一个'WebForm - Copy'文件夹)。
  2. I renamed the folder to 'WebForm.zip' per Chris' instructions. 我根据Chris的说明将文件夹重命名为'WebForm.zip'。
  3. I then tried to add a new WebForm to my project and ... 然后我尝试将新的WebForm添加到我的项目中......

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 在我的例子中 ,路径是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. 找不到路径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. 请注意,我路径中的CSharp\\Web与Chris路径中的web\\csharp不同。 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. 所以在离开诱饵之后找到了这个新文件夹(我确信这是Chris和其他人的正确道路),我在另一个文件夹中再次尝试了Chris的解决方法,一切都运行得很好。

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? 我很遗憾在Visual Studio文件结构中存在这样的重复,但是,嘿 - 为什么我首先得到这个错误?

This is very frustrating. 这非常令人沮丧。 It is looking for a .zip folder. 它正在寻找一个.zip文件夹。

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. 我使用的快速修复只是复制它抱怨的任何模板文件夹中的所有目录,并添加.zip到最后。 Xcopy lets you do this efficiently. Xcopy可以让您高效地完成此任务。 I had to do this a few times as VS uses a number of different locations for templates. 我不得不这样做几次,因为VS使用了许多不同的模板位置。

Open a console here: C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\ItemTemplatesCache\\CSharp\\Web\\1033 在这里打开一个控制台: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" 如果你导航到一个文件夹(即Web)和Shift +单击1033文件夹,你可以选择“在这里打开命令窗口”

Run this to rename all folders to folder.zip 运行此命令将所有文件夹重命名为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> 这对我来说工作将文件复制到C:\\ Program Files(x86)\\ Microsoft Visual Studio 11.0 \\ Common7 \\ IDE>

run in cmd the command: 在cmd中运行命令:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Visual Studio 2012 Express Edition中找不到安装和部署 - Can't find Setup and Deployment in Visual studio 2012 express edition 无法在Visual Studio 2012中使用FileSystemWatcher - Can't use FileSystemWatcher in Visual Studio 2012 Visual Studio 2012 Web API项目将无法运行 - 找不到Newtonsoft.Json - Visual Studio 2012 Web API project won't run - can't find Newtonsoft.Json Visual Studio 2012 - 在 .NET 4.5 框架中找不到 System.Transactions 程序集 - Visual Studio 2012 - Can't find System.Transactions assembly in .NET 4.5 framework 如何在Visual Studio 2012中为C#生成T4(运行时)模板设置文件扩展名 - How to set the file extension for C# generating T4 (runtime ) templates in visual studio 2012 无法在Visual Studio Ultimate 2012上安装BenchmarkDotNet 0.10.2 - Can't install BenchmarkDotNet 0.10.2 on Visual Studio Ultimate 2012 无法连接到Visual Studio 2012中的SQL Server - Can't connect to SQL Server in visual studio 2012 Visual Studio 2012:无法添加报表查看器? - Visual Studio 2012: can't add Report Viewer? 无法在Visual Studio 2012中添加存储过程 - Can`t add stored procedure in Visual Studio 2012 无法在Visual Studio 2012中安装任何NuGets - Can't install any NuGets in Visual Studio 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM