TypeScript : Emit Error: Write to file failed..

category: [ VSTS / TFS ] tags: [ TFS ] [ TFS Build ] [ TypeScript ] [ Visual Studio ] [ VSTS / TFS ]
created: 15 Nov 2013 @ 09:30 modified: 02 Aug 2018 @ 19:52


I have been playing around with TypeScript for a while and usually I just publish from my machine Embarrassed smile but today I decided to setup a CI build for the solution and found that I received the error

 <Path to file>.ts (1): Emit Error: Write to file failed..

When a build agent checks out code for building the primary source files are locked so obviously it wouldn't let me overwrite any as part of my build process.

It took me a couple of minutes to realize it but this error was basically due to me having checked in the .js and .jsmap file that is generated for .ts files when you build a TypeScript enabled project. Simple enough to fix:

1. Remove all .js and .jsmap files that are generated off .ts files from your project

2. Make sure those same files are deleted from source control

3. Kick off the build and smile because things should be running smoothly again Smile

ABOUT ME

Gordon Beeming works at Nologo Studios in the sunny city of Durban, South Africa. He is the Lead for the Data and Services Team and has a strong focus on Developer Efficiencies and R&D. When he's not hacking away at a keyboard in Visual Studio he'll generally be relaxing with his family or hitting the black top getting in some mileage. He is a Visual Studio ALM Ranger and Visual Studio ALM MVP.

Follow me on Strava