I've been debugging an issue for a day now and can't seem to figure it out. Perhaps someone else has run into something similar and can shed some light?
We've configured all T4 templates within a project in our solution to run when the project is built, as in shift-ctrl-b. This works great - it required us to add this import statement to the project .csproj file:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\TextTemplating\Microsoft.TextTemplating.targets"/>
We've set up continuous integration through Visual Studio 2012 and cloud TFS (tfs.visualstudio.com). When our solution is being built on TFS' hosted controller, we keep receiving the following error:
The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\TextTemplating\Microsoft.TextTemplating.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
On our dev machines, the file exists and thus the problem seems to be that the file doesn't exist on the hosted build server.
If we're correct with this assumption, is there a workaround to this issue besides installing our own TFS build server?
I doubt the hosted build servers have Visual Studio 2010 (v10.0) on them.
You can get a list of what is currently installed on the hosted build servers here, Tarun Arora has more details here.
For your problem, try version 11.0
(for VS2012) instead:
<Import Project="$(MSBuildExtensionsPath)
\Microsoft\VisualStudio\v11.0\TextTemplating\Microsoft.TextTemplating.targets"/>
A better approach would be to use the VisualStudioVersion
MSBuild property:
<Import Project="$(MSBuildExtensionsPath)
\Microsoft\VisualStudio\v$(VisualStudioVersion)\TextTemplating\Microsoft.TextTemplating.targets"/>
This will ensure that future updates to the Hosted Build Servers do not impact your code. Have a read up here for more details.
Perhaps some files are missing. :) So I was at the same situation. Here is the solution.
The correct solution is to install
Microsoft Visual Studio 2010 Visualization & Modeling SDK http://www.microsoft.com/en-us/download/confirmation.aspx?id=23025
It creates the folder
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TextTemplating and the files Microsoft.TextTemplating.targets and others
Microsoft Visual Studio 2012 Visualization & Modeling SDK http://www.microsoft.com/en-us/download/confirmation.aspx?id=30680
It creates the folder
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\TextTemplating and the files Microsoft.TextTemplating.targets and others
Enjoy! ;)
P.S. Somehow Microsoft Visual Studio 2010 Visualization & Modeling SDK creates the folder here
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With