clariuslabs / TransformOnBuild

Transform Text Templates On Build
Apache License 2.0
48 stars 17 forks source link

Not working in VS 2017 #42

Closed marnilss closed 6 years ago

marnilss commented 7 years ago

Hi, I uninstalled my VS 2015 (with everything working) and installed VS 2017. Apparently the paths to the TextTransform.exe has changed radically. Mine is under "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\TextTransform.exe" (Enterprise version installed).

This causes the buildstep to fail!

kzu commented 7 years ago

I've moved on to using Mono.TextTemplating nuget package, which not only is compatible, but faster in my experience

tuffff commented 7 years ago

As a workaround, you can create a symlink on the folder (not the file).

PS: New-Item -ItemType SymbolicLink -Path 'C:\Program Files (x86)\Common Files\Microsoft Shared\TextTemplating\14.0' -Target 'C:\Program Files (x86)\Microsoft Visual Studio\2017\<Edition>\Common7\IDE\'

pratikvasani commented 7 years ago

I got around this by adding

<TextTransformPath>$(DevEnvDir)\TextTransform.exe</TextTransformPath>

to the csproj file under

marnilss commented 7 years ago

@pratikvasani , thank you! Great workaround, until this hopefully finds its way into an update of this package.

marnilss commented 7 years ago

Did not mean to close this issue. I think the workaround from @pratikvasani should be included in next release.

petrsnd commented 7 years ago

The fix to this is easy, but I don't see the code here... Is this still being built from this repository? I'd like to just put up a pull request.

The Clarius.TransformOnBuild.targets file from version 1.1.12 just needs this patch:

--- Clarius.TransformOnBuild.1.1.12\build\Clarius.TransformOnBuild.targets  Fri Feb 06 01:13:10 2015
+++ Clarius.TransformOnBuild.1.1.12\build\Clarius.TransformOnBuild.targets  Mon Jun 19 12:43:13 2017
@@ -17,6 +17,7 @@
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <PropertyGroup>
+        <_ProgramFiles>$([System.Environment]::GetEnvironmentVariable('ProgramFiles(x86)'))</_ProgramFiles>
         <_CommonProgramFiles>$([System.Environment]::GetEnvironmentVariable('CommonProgramFiles(x86)'))</_CommonProgramFiles>
        <_CommonProgramFiles Condition=" '$(_CommonProgramFiles)' == '' ">$(CommonProgramFiles)</_CommonProgramFiles>       
        <TextTransformPath Condition="'$(TextTransformPath)' == ''">$(_CommonProgramFiles)\Microsoft Shared\TextTemplating\$(VisualStudioVersion)\TextTransform.exe</TextTransformPath>
@@ -29,6 +30,7 @@
         <!-- Future proof 'til VS2013+2 -->
         <_TransformExe Condition="!Exists('$(_TransformExe)')">$(_CommonProgramFiles)\Microsoft Shared\TextTemplating\13.0\TextTransform.exe</_TransformExe>
         <_TransformExe Condition="!Exists('$(_TransformExe)')">$(_CommonProgramFiles)\Microsoft Shared\TextTemplating\14.0\TextTransform.exe</_TransformExe>
+        <_TransformExe Condition="!Exists('$(_TransformExe)')">$(ProgramFiles)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\TextTransform.exe</_TransformExe>
    </PropertyGroup>

     <Target Name="TransformOnBuild" AfterTargets="BeforeBuild">
mrlarson2007 commented 7 years ago

That seems pretty easy, why can't we just get that in, what is blocking?

kzu commented 7 years ago

https://github.com/clariuslabs/TransformOnBuild/blob/master/nuget/build/Clarius.TransformOnBuild.targets

I will suggest it again: the Mono.TextTemplating works great and is WAY faster, and does not depend on anything other than the simple nuget package.

I've moved on from relying on the VS tool. It's not actively maintained AFAIK, and it's SLOWWWWWW.

Grinch commented 7 years ago

@petrsnd Do note that your proposed diff only covers an Enterprise variant of VS 2017 for the TextTransform.exe location.

To cover the other variants you'd have to swap the 'Enterprise' part with 'Community' and so on.

picrap commented 6 years ago

This is fixed in version 2.5.25.

jackgerrits commented 6 years ago

Is version 2.5.25 available as a nuget package? The latest I can see is 1.21.0

aukaurea commented 5 years ago

I got around this by adding

<TextTransformPath>$(DevEnvDir)\TextTransform.exe</TextTransformPath>

to the csproj file under

in which section ??