You just need to check-in only the TypeScript (.ts) file in your source control. TSC complier will take care of generating the JS in build server ( you need to configure that) or in local ( that you already have installed). So, here is your quick fix:
- Remove all .js and .jsmap files that are generated off .ts files from your project. ( Note : only .js can do the job for you as well)
- Check in your changes ( removing the .js and .jsmap) to TFS.
Here is another alternative solution, in case you don’t want to remove the JS file. Because, if you remove the JS for time being, and any other developer check in those file again into TFS, the same error will come occur. (more over those are hidden files, so if you don’t check-in carefully, they can be checked-in in TFS)
So, here is another trick for you. In this case, you can run a Pre-Build event, that will remove all read-only attributes of the JS files for that project.
1. Right Click on the Project and Open the Project Property Window
2. Select the Build Event Tab
3. Write the following commands in the pre-build event of the project.
attrib -r /s "$(ProjectDir)*.js"
This will ensure, all the JS file release the Read-Only attributes and there will not be any error for write to file failed.
Hope this helps.
Feel free to share your comments.