In the spirit of a solution found should be shared, I am getting the following error when building a WPF project using TFS. The project would build fine on the local dev machine, as well as on the build server using VS or msbuild, just not when it was built via TFS.
error MC4108: The root of a Template content section cannot contain an element of type '{0}'. Only FrameworkElement and FrameworkContentElement types are valid.
It is pointing 开发者_开发技巧to a custom control contained within a data template:
<Window.Resources>
<DataTemplate x:Key="TabItemTemplate">
<d:ConnectionControl />
</DataTemplate>
</Window.Resources>
The workaround that I found was to wrap the custom control in a Grid:
<Window.Resources>
<DataTemplate x:Key="TabItemTemplate">
<Grid>
<d:ConnectionControl />
</Grid>
</DataTemplate>
</Window.Resources>
I guess it's not a bad workaround, but the markup in the question should have worked.
There should be no difference in terms of build errors between building via TFS Build and building locally because both use MSBuild. Please make sure a few things:
- When you tried building locally or on the build machine, did you use the exact MSBuild command from the TFS Build log?
- Are the versions of MSBuild matched for the one used by TFS Build and the one you used?
Hope this helps.
精彩评论