There is probably a problem with TFS Visual Studio project conducted together with Typescript.
On build tsc can't overwrite the readonly .js file an throws Permission denied error.
Error 1 Permission denied
Error 2 The command ""C:\Program Files (x86)\Microsoft SDKs\TypeScript\0.8.0.0\tsc
"c:\users\schlicht\documents\visual studio 2012\Projects\TypeScriptHTMLApp1\TypeScriptHTMLApp1\app.ts"" exited with code 1.
Is it possible without explicitly checking out the files to use a build with tsc?
Here's a workaround: To keep your JS files as part of the project and in source control.
Use a Local Workspace, as this does not apply the read-only flag on files, so saving the .JS files do not require a check-out for it to be written to.
I found this because I was not exhibiting this problem, but others in my team were, so after some digging I found out what was different. I was using a Local Workspace instead of a Server Workspace.
The other team members have converted to a Local Workspace and they are smooth sailing once again.
Now, if your build server is configured for the Typescript run, TSC will run and generate the JavaScript files.
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)
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
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.
Source : http://dailydotnettips.com/2014/05/03/typescript-emit-error-write-to-file-failed-how-to-resolve
Don't check in the .js file. We use this approach on our TypeScript project and it works well. There is no need to have the generated .js in source control; think of the .js files as project output, like a .exe or .dll.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With