编辑"testproject.zip";停止"UnitTest1.cs"被创造 [英] Editing "testproject.zip" to stop "UnitTest1.cs" being created

查看:115
本文介绍了编辑"testproject.zip";停止"UnitTest1.cs"被创造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在修改VS2010项目和项目模板,因此每次我们执行新项目"或新项目"时,都会以对我们有用的格式来创建它.一切正常.如果我们创建一个新的类库,则会使用我们设置的引用来获取它,并且不会创建"class1.cs"文件-一切正常.我们对位于以下位置的TestProject.zip文件进行了类似的更改:

I've been modifying the VS2010 item and project templates so each time we do a "new project" or "new item" we get it created in a format that works for us. This is all working fine; if we create a new class library we get it with the references we've set up and it doesn't create the "class1.cs" file - that all works. We've made a similar change to the TestProject.zip file that lives in:

C:\ Program Files(x86)\ Microsoft Visual Studio
10.0 \ Common7 \ IDE \ ProjectTemplates \ CSharp \ Test \ 1033

C:\Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\ProjectTemplates\CSharp\Test\1033

完成了将其压缩后再备份,将其复制到原始文件顶部并刷新缓存的相同过程.但是对于测试项目,我们无法停止创建默认的"unittest1.cs"文件.我们对测试项目的所有其他更改都可以正常工作,但是我们无法阻止它创建"unittest1.cs"文件.它最初从不在模板或csproj文件中,所以我不确定是什么创建的.

Gone through the same process of zipping it back up, copying it over top of the original and refreshing the cache. However for the test project we can't stop it creating the default "unittest1.cs" file. All of our other changes to the test project are working fine but we just can't stop it creating the "unittest1.cs" file. It was never in the template or csproj file originally so I'm not sure what is creating it.

任何人都可以帮忙吗?是什么为测试项目创建了默认的测试文件-我想知道它是否是对模板文件中向导的引用,但不知道需要进行哪些更改.

Can anyone help? What creates the default test file for the test project - I'm wondering if it's a reference to the wizard that is in the template file but have no idea what changes would be needed.

推荐答案

  1. 关闭Visual Studio
  2. 从以下位置提取BasicUnitTest.zip:

C:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ ItemTemplates \ CSharp \ 1033

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\1033

  • 打开BasicUnitTest.vstemplate

    删除<ProjectItem ReplaceParameters="true">UnitTest.cs</ProjectItem>

    转到:

    C:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ ItemTemplatesCache \ CSharp \ 1033

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplatesCache\CSharp\1033

  • 删除UnitTest.cs并将BasicUnitTest.vstemplate替换为修改后的副本

  • Delete UnitTest.cs and replace BasicUnitTest.vstemplate with your modified copy

    尽管您可以为每个默认模板执行此操作,但我建议基于BasicUnitTest.zip创建一个新模板,而不要覆盖Visual Studio附带的模板.它更容易,更安全,并且不会被以后的Service Pack覆盖.

    Though you can do this for every default template, I recommend creating a new template based on the BasicUnitTest.zip instead of overriding the ones shipped with Visual Studio. It's easier, safer and won't be overwritten by future service packs.

    这篇关于编辑"testproject.zip";停止"UnitTest1.cs"被创造的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆