问题
I know I can export my own project template, but I'd like to know how to edit the actual, Visual Studio Test Project template's C# UnitTest1.cs file. I've been unable to locate it in my C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE folder tree. Anybody know where this lives so I can modify it?
回答1:
Try C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\1033\BasicUnitTest.zip
Or
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\1033\SimpleUnitTest.zip
- Extract the files from Archive,
- Change the SimpleUnitTest.cs as you want
- Back up the old SimpleUnitTest.zip
- Zip back the now changed files and name the Archive SimpleUnitTest.zip and copy it to the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\1033\ location.
After that:
- Back up the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\1033\SimpleUnitTest.zip folder
- copy the changed, unnpacked items (in your case SimpleUnitTest.cs) over to the C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\1033\SimpleUnitTest.zip.
来源:https://stackoverflow.com/questions/5434772/how-can-i-modify-the-default-unittest1-cs-file-template-in-the-visual-studio-201