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="&quot;$(PROGRAMFILES)Microsoft
      SDKsTypeScript .8.0.0tsc&quot; @(TypeScriptCompile
      ->'&quot;%(fullpath)&quot;', ' ')" />
</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 &quot;$(MSBuildProjectDirectory)
        Scriptstypescript*.js&quot;" />
    <Exec Command="&quot;$(PROGRAMFILES)Microsoft
       SDKsTypeScript .8.0.0tsc&quot; @(TypeScriptCompile
          ->'&quot;%(fullpath)&quot;', ' ')" />
  </Target>

Related articles

  • Cloud Native
  • Application Navigator
  • Kubernetes Platform
  • Digital Workspace
  • Cloud Infrastructure
  • ITTS (IT Transformation Services)
  • Managed Security Operations
  • Multi-Cloud Platform
  • Backup & Disaster Recovery
Visit our knowledge hub
Visit our knowledge hub
ITQ

Let's talk!

Knowledge is key for our existence. This knowledge we use for disruptive innovation and changing organizations. Are you ready for change?

"*" indicates required fields

First name*
Last name*
Hidden