If you include typescript in your project like Scott Hanselman describes here, you end up with this in your csproj file:
<Target Name="BeforeBuild"> <Exec Command=""$(PROGRAMFILES)Microsoft SDKsTypeScript .8.0.0tsc" @(TypeScriptCompile ->'"%(fullpath)"', ' ')" /> </Target>
Which is fine and works… until you try to build this with TFS build.
Your build will likely with an error like this:
C:Builds2ITQZorin DevSourceszorinITQ.Zorin.Web
ITQ.Zorin.Web.csproj (344): The command
""C:Program Files (x86)Microsoft SDKsTypeScript .8.0.0tsc"
"C:Builds2ITQZorin DevSourceszorinITQ.Zorin.WebScripts
TypeScriptNotifications.ts"
"C:Builds2ITQZorin DevSourceszorinITQ.Zorin.WebScripts
TypeScriptVM.ts"" exited with code 1.
This is because the .js files are readonly and the typescript
compiler tries to overwrite them.
Simply changing the readonly attribute with Attrib –b in the
BeforeBuild event will solve this problem:
<Target Name="BeforeBuild"> <Exec Command="attrib -r "$(MSBuildProjectDirectory) Scriptstypescript*.js"" /> <Exec Command=""$(PROGRAMFILES)Microsoft SDKsTypeScript .8.0.0tsc" @(TypeScriptCompile ->'"%(fullpath)"', ' ')" /> </Target>