I have a solution with 3 projects and i have a reference between two of the projects and a reference to a .dll from a project in all 3 projects. The project are in Silverlight. I want to make a multi-project template and when i create a new project from that template the references doesn't work anymore. It make the modification to the namespace and project name, 开发者_如何学Pythonbut the references aren't updated. And the references at the .dll doesn`t work in the new project made from template.
The project are in Silverlight and C# 4.0.
Thanks.
The way I understand your description, you have two problems:
- A project reference from project A to project B is broken when the projects are instantiated
- A reference to a dll is broken when the project is instantiated
I'm also having problems with 1), and haven't found a way to solve that yet.
For 2) you must make sure that the dll you are referencing is part of the project itself, and is listed in the project's content in your vstemplate metadata file.
See for instance my template for F# and XNA: In the .fsproj file (similar to a .csproj for a C# project):
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>Dependencies\FSharp.Core.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Dependencies\FSharp.Core.dll"/>
<None Include="Dependencies\FSharp.Core.xml"/>
<None Include="Dependencies\FSharp.Core.sigdata"/>
<None Include="Dependencies\FSharp.Core.optdata"/>
</ItemGroup>
In the .vstemplate file:
<Folder Name="Dependencies" TargetFolderName="Dependencies">
<ProjectItem ReplaceParameters="false" TargetFileName="FSharp.Core.dll">FSharp.Core.dll</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="FSharp.Core.xml">FSharp.Core.xml</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="FSharp.Core.optdata">FSharp.Core.optdata</ProjectItem>
<ProjectItem ReplaceParameters="false" TargetFileName="FSharp.Core.sigdata">FSharp.Core.sigdata</ProjectItem>
</Folder>
See also Visual Studio Project Template and Private Assembly Referencing for an alternative solution if you don't want to include the dll in your template.
精彩评论