TFS Hosted Build Controller - Microsoft.TextTemplating.targets not found
Asked Answered
J

3

6

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?

Jesus answered 20/8, 2013 at 16:34 Comment(0)
M
6

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.

Misdeed answered 20/8, 2013 at 16:44 Comment(4)
Thanks for getting back. I originally used v11.0 and was still receiving the same error.Jesus
Yeah <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets" /> is not working for me as wellTompion
I and Tarun Arora have developed a Visual Studio extension to get software installed on the hosted build servers. This helps you to view the details within Visual Studio. It works for Visual Studio 2012/2013. Download it from here: - Avanade Extensions for VS2012 - Avanade Extensions for VS2013Hesperus
Nice to use v$(VisualStudioVersion) but TextTemplating can't be find for VS2013Renell
T
1

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

Tompion answered 27/9, 2013 at 11:57 Comment(0)
K
0

The Microsoft.TextTemplating.targets file comes with overhead you probably don't need (Modeling SDK for Microsoft Visual Studio). You can most likely get away with a simple NuGet package that transforms on build (using TextTransform.exe): Clarius.TransformOnBuild.

For more information see the author's blog post.

Keelson answered 20/8, 2016 at 11:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.