TypeScript v1.7 MSBuild tooling breaks web application publish
Summary
Installing TypeScript 1.7 tooling for Visual Studio causes different behaviour from 1.6 when publishing web applications, both from within Visual Studio (right click > publish) and via msbuild.exe (/p:DeployOnBuild=true).
This issue has only been observed using a file system publish.
Symptoms
Generated JavaScript is no longer included in the packaged / published output.
Observations
It appears there is a difference in the MSBuild Content ItemGroup's metadata. I believe that previously the generated JavaScript files were being included in the Content ItemGroup as paths relative to the .csproj file:
Scripts\App.js
As of 1.7 it appears the generated JavaScript files are now being included in Content as absolute paths:
C:\Projects\Solution\Web\Scripts\App.js
Perhaps this is causing a problem for the web publishing mechanism?
@paulvanbrenk has been looking into this, we are talking to the azure tools team to figure out the issue and get back to you.
Thanks — please keep me updated.
What has made this issue worse for me is that uninstalling the VS tooling leaves the MSBuild tooling files in place.
Repairing the 1.6 tooling installation replaced the .targets and .props files but crucially not the task .dll file which, based on a diff of the compiled code, is possibly where the issue lies.
I've managed to successfully revert back to the 1.6 tooling for VS 2013 by deleting the TypeScript MSBuild directory before repairing the 1.6 tooling installation.
To make matters a little more complicated, machines that also had VS 2015 also installed had to have the 1.6 tools for VS 2015 repaired, even though the 1.7 tooling for VS 2015 had not been installed at all.
:+1:
Can any of you share the diagnostic MSBuild log?
I have produced a repro of the issue using File > New project > Empty ASP.NET Web Application and can confirm simply overwriting the TypeScript.tasks.dll with the one from 1.6 tooling avoids the bug.
How would you like me to supply the repro files?
Ok, I think I have a fix for this specific issue, which required changes to the MSBuild task, and is not an easy fix in the targets file.
Great, thanks.
Can you indicate when the fix will be available? Is there a workaround other than to avoid 1.7 until the fix is ready?
This is affecting us. Is it just a problem with using the custom TypeScriptOutDir?
To elaborate:
We have two projects running (older using TypeScript 1.5, newer recently upgraded from 1.6 to 1.7).
After installing 1.7, both projects compile fine through the IDE.
Both projects fail using our build machine (msbuild.exe)
It errors out on the step: Copying Web Application Project Files for UI.Website complaining that it cannot copy JS files from a directory they shouldn't be in (due to our TypeScriptOutDir setting).
Edit 1: Elaborate Edit 2: Both projects fail using msbuild.exe after installing 1.7.
StackOverflow here: http://stackoverflow.com/questions/34048228/tfs-build-error-after-installing-visual-studio-2015-update-1
@JiriZidek the issue you linked is VS 2015, the issue discussed here is VS 2013.
But worth noting that VS2015 update 1 ships with TypeScript v1.7 tools. Haven't tried a repro on VS2015 though.
@mattbrooks2010 Don't have an obvious work around, and we're investigating an Azure publishing issue, which makes the timeline uncertain.
@paulvanbrenk thanks for the update.
Given I can swap back to the previous TypeScript.tasks.dll from 1.6 and 'fix' the issue, I don't understand how this can be an issue with the web publishing tooling — unless that always had an unsurfaced bug. Please would you elaborate?
There was an issue with the way we calculate the output path when you used the 'outdir' option, however the fix we made wasn't sufficiently tested for the web publishing scenario: we used a full path, where a relative path was expected.
OK so the issue with absolute vs relative paths is consistent with my initial analysis above.
However I don't understand, given this is a behaviour change between the 1.6 and 1.7 tooling, how this is a web publishing or Azure tooling issue. Are absolute Content ItemGroup paths supposed to be supported?
Thanks for your feedback on this issue so far.
It has to do with how we calculate the path of the generated files, and collect those files for the publishing step. It's not related to the way .ts files are represented in the project file.
I attach full build log, however there is nothing very ineteresting, but the end:
Creating directory "C:\Builds\3\ICCNG\Development\bin\WebClient\_PublishedWebsites\WebClient\C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts".
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets(182,5): error MSB3021: Unable to copy file "C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts\InternalChat.js" to "C:\Builds\3\ICCNG\Development\bin\WebClient\_PublishedWebsites\WebClient\C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts\InternalChat.js". Uvedený formát cesty není podporován. [C:\Builds\3\ICCNG\Development\src\Development\WebClient\WebClient.csproj]
Creating directory "C:\Builds\3\ICCNG\Development\bin\WebClient\_PublishedWebsites\WebClient\C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts".
1>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets(182,5): error MSB3021: Unable to copy file "C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts\InternalChat.js.map" to "C:\Builds\3\ICCNG\Development\bin\WebClient\_PublishedWebsites\WebClient\C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts\InternalChat.js.map". Uvedený formát cesty není podporován. [C:\Builds\3\ICCNG\Development\src\Development\WebClient\WebClient.csproj]
1>Done Building Project "C:\Builds\3\ICCNG\Development\src\Development\WebClient\WebClient.csproj" (default targets) -- FAILED.
Build FAILED.
"C:\Builds\3\ICCNG\Development\src\Development\WebClient\WebClient.csproj" (default target) (1) ->
(_CopyWebApplicationLegacy target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets(182,5): error MSB3021: Unable to copy file "C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts\InternalChat.js" to "C:\Builds\3\ICCNG\Development\bin\WebClient\_PublishedWebsites\WebClient\C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts\InternalChat.js". Uvedený formát cesty není podporován. [C:\Builds\3\ICCNG\Development\src\Development\WebClient\WebClient.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets(182,5): error MSB3021: Unable to copy file "C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts\InternalChat.js.map" to "C:\Builds\3\ICCNG\Development\bin\WebClient\_PublishedWebsites\WebClient\C:\Builds\3\ICCNG\Development\src\Development\WebClient\Scripts\InternalChat.js.map". Uvedený formát cesty není podporován. [C:\Builds\3\ICCNG\Development\src\Development\WebClient\WebClient.csproj]
0 Warning(s)
2 Error(s)
@paulvanbrenk sure, I understand that. I'm referring to this:
<ItemGroup>
<FilesForPackagingFromProject Include="@(GeneratedJavascriptWithTargetPath->'%(Identity)')"/>
<ContentWithTargetPath Include="@(GeneratedJavascriptWithTargetPath->'%(Identity)')"/>
<Content Include="@(GeneratedJavascript->'%(Identity)')"/>
</ItemGroup>
The issue is related to the contents of one of those ItemGroups. The difference in that content between 1.6 and 1.7 is due to different code in TypeScript.tasks.dll, am I correct?
So I'm still not clear how this is a web publishing issue.
The files in this collection don't have the right relative path GeneratedJavascriptWithTargetPath, which the web publishing task expects.
@JiriZidek the interesting bits are not in this log, I need the 'diagnostic' log, which you can get with the /v:diagnostic /fl option.