I've been trying to get custom CodeTemplates working in VS2017 Community edition without much luck. I've copied the %Program Files%\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding
files to CodeTemplates/ in my proj, tweaked the templates but I don't see any changes. I've customized the templates in prior vers of VS. Is it not supported in VS2017 Community Edition?
It works well in Visual Studio 2017. And yes that's the right folder you are looking at. You must copy the files as you did already and make sure to delete all the .vb.t4 if you are using c# as language from the CodeTemplates folder and vice-versa.
One more suggestion is to check and tweak the right template, since it has got withContext, withAction, Empty, etc...
EDIT :
Also when scaffolding, try to add -Verbose to the command, it'll tell you from where the templates are picked.
you can find it here:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\Web\Mvc\Scaffolding\Templates\MvcView
Related
Using VSTS (not git) and use Visual Studio 2017 libman to manage client-side libraries. These libraries are put in wwwroot\lib. I don't want to add these to source code control.
I've tried putting a .tfignore in my project folder with:
wwwroot\lib
I also tried:
\wwwroot\lib
Regardless of what I do, all the wwwroot\lib files are put in source code control when I add a new client-side library via libman.
How can I ignore the lib files since they are managed/restored by Visual Studio libman feature?
Based on the comment above from Seabizkit, **/wwwroot/lib worked for me.
.cs project file
The project was created using Visual Studio 2010 and I am trying to open it in Visual Studio 2010 itself but still I am facing this problem.
I have opened this project in VS 2012 and worked for few days but it has created in Visual studio 2010. Is there anything which preserve the project details on local machine?
This is the specific project section in my solution file:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project Name", "Project Name\project name.csproj", "{48C1190E-7700-461B-ADCD-B5E0F1ECAD21}"
ProjectSection(ProjectDependencies) = postProject
{1F5440B3-9FD8-4FE2-B621-8697489ABDC4} = {1F5440B3-9FD8-4FE2-B621-8697489ABDC4}
EndProjectSection
EndProject
In Visual Studio it is possible to add Project Types, e.g. for creating an MSI, by installing an Add-On to the development machine. It appears that in the past this was done, and then that new Project Type was used to add a Project to the Solution. But now you are opening the Solution on a machine that does not have that new Project Type.
Look for the GUID of the missing Project Type, it should be part of the error you are getting. Then google "project type {the-guid}" to see which Add-On you need to install on your development machine.
It is also possible that a new Project Type was used in the Solution that simply can not work with VS 2010. In that case your options are either to keep using VS2012, or to start over with a new Solution in VS2010 and migrate the projects into it that are compatible (which may be a bit tricky or hard to do if VS2012 saved them).
Would it be too difficult to just recreate the project and include all the necessary files and references? Once the project was saved from VS 2012, the format may have broken compatibility with 2010. Sometimes this is fixable just by updating the version number in the project file, but I don't see it in your image.
I recently applied Update 5 to Visual Studio 2013 (Ultimate Edition) running on Windows 8.1. After the update, any time I try to create a Razor View (*.cshtml) file in my MVC application using scaffolding, I get the following error:
There was an error running the selected code generator:
The Templates\PackageVersion5.1.3.xml file is missing from the
installed template folder
From the error, it is clear that some file (PackageVersion5.1.3.xml) is missing but I'm not sure how to fix it. I even repaired Visual Studio but to no avail.
As yoo probably know during scaffolding your view is generated base on this missing xml file. I don't know why your file is not there but you can copy it from one of your colleagues computer or reinstall visual studio.
Maybe you have change something i VS options?
I avoid the scaffolding options in Visual Studio.
Why? In my experience, the standard MVC pattern where everything separated by type will always led to a difficult to manage and test solution.
Instead, I now prefer to organise MVC projects by feature (http://timgthomas.com/2013/10/feature-folders-in-asp-net-mvc/).
I've created an Umbraco 7.1.8 in Visual Studio 2013 using MVC templates. When I edit the templates in Visual Studio the editor slows right down and VS shows a permanent 13% usage in Task Manager. If it helps, I'm using Windows 8.1 64-bit on a machine with a 2.3GHz quad-core cpu. Other projects work fine.
Any help/suggestions would be appreciated.
Jason
Okay, found out what the problem was. It turns out if you don't include the .cshtml file in your Visual Studio project (just edit it with Show All Files enabled), you don't get Intellisense and it results in the CPU usage and performance issue I described.
So basically, if you're editing files in Visual Studio, make sure they're included in the project (not greyed out in the Solution Explorer). I'll accept this as the answer as soon as it lets me.
i did an upgrade and it caused lots of problems. unfortunately i didn't back it up. Is there anyway i can convert a 2010 solution file back into asp.net mvc 2008?
Make a backup of what's left of what you currently have before doing this ...
Create a new solution in Visual Studio 2008. Create new projects for the 2008 solution. Use the project menu or right-click the project and choose "Add Existing Items..." Choose all the code files .cs .vb, etc from your 2010 structure and include them in the 2008 structure.
Basically you're copying all the code back into a 2008 structure with the 2008 formatted project and solution files. The code shouldn't be substantially changed beyond repair. You might have to manually address some issues in the converted code but once you know what they are it will be a repetitive process more than anything.
If you are writing code of any importance you should be using a version control system like as SVN. I haven't tried Visual Studio 2010 yet, but can tell you from experience that the differences between 2005 and 2008 are laughably small. You can down convert a 2008 solution file by manually changing the first two lines from:
Microsoft Visual Studio Solution File, Format Version 10.00
Visual Studio 2008
to
Microsoft Visual Studio Solution File, Format Version 9.00
Visual Studio 2005
the project files are fairly trivial as well with the product tag changing from:
9.0.21022
to
8.0.50727
Please note the changes I have listed for project files may not be 100% accurate and I have not tested for differences between service pack releases. However, creating a new project in an earlier version of Visual studio, making a copy and then doing an upgrade should allow you to run a diff and provide a better answer than what is currently accepted.