This project is read-only.

Null Reference when using MS build.

Mar 6, 2012 at 1:46 AM

I'm using templates and a generator which all work fine from within VS but when i attempt to build using msbuild I get a NullReferenceException.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error : An Exception was thrown while running the transformation code. The process cannot continue.  The following Exception was thrown:\r [...tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error : System.NullReferenceException: Object reference not set to an instance of an object.\r [C:\repos\eeqe2\project\build\tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error :    at T4Toolbox.DteProcessor.UpdateFiles(ICollection`1 outputFiles)\r [...tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error :    at T4Toolbox.OutputManager.UpdateFiles()\r [...tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error :    at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)\r [...tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error :    at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)\r [...tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error :    at T4Toolbox.TransformationContext.OnTransformationEnded(TextTransformation transformation)\r [C:\repos\eeqe2\project\build\tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error :    at Microsoft.VisualStudio.TextTemplating77CB75A1F077BA55EEE9D90CA4E9E2B6.GeneratedTextTransformation.Dispose(Boolean disposing) in ...tools-src\ExceptionGeneration\Generator\CreateExceptions.tt:line 18\r[...tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error :    at Microsoft.VisualStudio.TextTemplating.TextTransformation.Dispose()\r [...tools-src\ExceptionGeneration\Generator\Generator.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TextTemplating\v10.0\Microsoft.TextTemplating.targets(396,5): error :    at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result). Line=0, Column=0 [...tools-src\ExceptionGeneration\Generator\Generator.csproj]

I have updated the project file with the t4toolbox directives and imported Microsoft.TextTemplating.targets.

 

Anyone have any ideas what the problem is?

thanks!

Mar 6, 2012 at 5:35 PM

Current version of the T4 toolbox does not support MSBuild.

Mar 6, 2012 at 6:27 PM

oh, after reading this article, http://www.olegsych.com/2010/04/understanding-t4-msbuild-integration/, I thought it did... was it that an older version of the T4Toolbox supported it?  Are there plans to make future versions compatible with msbuild or TextTransform.exe?

Apr 5, 2012 at 11:02 PM

That's a tought question. I have an idea on how that might work, but it would require a significant effort. So to answer your question, I don't know.