【发布时间】:2016-08-03 09:59:26
【问题描述】:
我想为 Visual Studio 2013 自定义 UnitTest 项目模板:我们在 UnitTest 项目中经常使用 Moq,因此我认为应该自动引用它。
在C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ProjectTemplates\CSharp\Test\1033\UnitTestProject 中,我通过添加参考部分和ItemGroup 编辑了UnitTestProject.csproj:
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
...
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
<Private>True</Private>
</Reference>
然后我将文件 packages.config 添加到该文件夹,并通过添加编辑UnitTestProject.vstemplate
<ProjectItem ReplaceParameters="false" TargetFileName="packages.config">packages.config</ProjectItem>
到项目部分。
但是当我创建一个新的 UnitTest 项目时,我收到了错误消息
The file packages.config could not be found within the project templates. Continuing to run, but the resulting project may not build properly.
点击确定后,出现另一条错误信息:
Unable to copy the file 'packages.config' from the project template to the project. Cannot find file "(%TEMP%\some folder)\packages.config'.
如何解决?
【问题讨论】:
标签: visual-studio visual-studio-2013 project-template