How do I handle relative Compile Includes in csproj of vstemplate

251 views Asked by At

I have a linked file in my csproj template:

<Compile Include="..\$saferootprojectname$\Shared Files\Mvx$saferootprojectname$.cs">

However, when the template is run, instead of leaving the relative path alone, Visual Studio substitutes the path of the temporary folder that is unzipped (and subsequently deleted!!!). The result is

>     Error 1   Source file 'C:\Users\tim\AppData\Local\Temp\mi0qfyf2.5lc\Okra\Shared
> Files\MvxOkra.cs' could not be found  \\vmware-host\Shared
> Folders\Documents\Projects\Temp\Plugins\Okra\Okra.Mac\CSC Okra.Mac

since the resulting csproj has

<Compile Include="C:\Users\tim\AppData\Local\Temp\k4psfgjk.22c\Crab\Shared Files\MvxCrab.cs">
  <Link>MvxCrab.cs</Link>
</Compile>

instead of the relative path. Is there any way to solve this without resorting to a Wizard?

Update. This can be resolved by adding <CreateInPlace>true</CreateInPlace> into the vstemplate. Then the relative path ends up right. However, I do not want this solution. I would like the solution that allows CreateInPlace to be false (it seems to be default now in VS2012), because my solution is on a network share and it triggers a "do you want to open" prompt for every project in the template (there are 8). (Even when I say don't Ask)

enter image description here

Maybe an alternative solution would be how I can make a network share trusted so this prompt doesn't happen.

0

There are 0 answers