Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issues with TypeScript and TFS

Tags:

typescript

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?

like image 408
iSchlicht Avatar asked Oct 08 '12 10:10

iSchlicht


3 Answers

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.

like image 182
haribo256 Avatar answered Sep 20 '22 03:09

haribo256


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

enter image description here

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

like image 22
Kishore Sahasranaman Avatar answered Sep 24 '22 03:09

Kishore Sahasranaman


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.

like image 28
iano Avatar answered Sep 21 '22 03:09

iano