I have a .cs file with a base class that I want to use from within many projects. I've first placed this cs file above the project folder (along side the .sln). Then, within the project, I've changed the
<Compile Include="BaseClass.cs">
to
<Compile Include="..\BaseClass.cs">
This works, and the file icon then has a little shortcut arrow.
The problem comes when I want to export the project as a project template. The BaseClass does not get included in the template because it is outside the project folder. I've tried adding the BaseClass.cs to the template zip and adding
<ProjectItem ReplaceParameters="true" TargetFileName="..\BaseClass.cs">BaseClass.cs</ProjectItem>
to the MyTemplate.vstemplate, but I get the error:
A target file name within the VSTemplate file is invalid, it contains a fully qualified path
If I remove the ..\, it includes the file directly.
If I leave the <ProjectItem> out of the .vstemplate file, and just put <Compile Include="..\BaseClass.cs"> in the .csproj file in the template, it looks for the file in Users/me/AppData/Local....
How can I get the template to reference a file outside the project directory?