Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad path when installing TypeScript 1.4 for Visual Studio 2013 #3493

Closed
danmarshall opened this issue Jun 12, 2015 · 38 comments
Closed

Bad path when installing TypeScript 1.4 for Visual Studio 2013 #3493

danmarshall opened this issue Jun 12, 2015 · 38 comments
Assignees
Labels
Bug A bug in TypeScript

Comments

@danmarshall
Copy link

I installed TS for VS2013 using this link: https://visualstudiogallery.msdn.microsoft.com/2d42d8dc-e085-45eb-a30b-3f7d50d55304

Close VS, reopen VS, create new TS HTML project, get these errors:

  • Your project file uses a different version of the TypeScript compiler and tools than is currently installed on this machine. No compiler was found at C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4\1.4\tsc.exe. You may be able to fix this problem by changing the element in your project file.
  • The specified task executable location "C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4\1.4\tsc.exe" is invalid.

Notice the "1.4" is doubled in the path.

@mhegazy mhegazy added API Relates to the public API for TypeScript Bug A bug in TypeScript and removed API Relates to the public API for TypeScript labels Jun 12, 2015
@kdcllc
Copy link

kdcllc commented Jul 21, 2015

The issue is with MSBuild. I am not completely sure but I think when VS.NET 2013 TypeScript Extension is installed it sets the version of the Typescript somewhere. TypeScriptToolsVersion = 1.4

So I modified the MSBuild for the machine: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript

to the following:

<PropertyGroup>
    <TypeScriptToolsVersion Condition="'$(TypeScriptToolsVersion)'==''">1.4</TypeScriptToolsVersion>
    <TscToolPath Condition="'$(TscToolPath)' == ''">$(MSBuildProgramFiles32)\Microsoft SDKs\TypeScript</TscToolPath>
    <TscToolPath Condition="'$(TypeScriptToolsVersion)' != ''">$(TscToolPath)\</TscToolPath>
    <!-- <TscToolPath Condition="'$(TypeScriptToolsVersion)' != ''">$(TscToolPath)\$(TypeScriptToolsVersion)</TscToolPath>-->
    <TscToolExe Condition="'$(TscToolExe)' == ''">tsc.exe</TscToolExe>
    <TscYieldDuringToolExecution Condition="'$(TscYieldDuringToolExecution)' == ''">true</TscYieldDuringToolExecution>
  </PropertyGroup>

@mhegazy mhegazy added this to the TypeScript 1.6 milestone Jul 21, 2015
@pkune2
Copy link

pkune2 commented Jul 27, 2015

The extra version in the path seems to be coming from the "VsTsc" task (TypeScript.tasks.dll) which appends the version number in the "FindToolPath()". So, the workaround is to remove the version from TscToolPath for now.

@paulvanbrenk
Copy link
Contributor

After some investigating, it seems that there is a mismatch between the targets file and the VsTsc task. Somewhere around the 1.4 timeframe we moved the logic for concatenating the version with the SDK path from the targets file to the task; so the version should only be added once.

So removing this line

<TscToolPath Condition="'$(TypeScriptToolsVersion)' != ''">$(TscToolPath)\$(TypeScriptToolsVersion)</TscToolPath>

is exactly what we did and is the correct solution.

Why or how this mismatch happens, I have no idea... and the linked threads don't give a good indication. My guess is that the specific order of installing versions (both TypeScript, VS, and possibly VS Updates) matters.

We have a plan to make our installer story behave better in this case, but that involves some setup architecture changes, which may not be ready for 1.6.

@kdcllc
Copy link

kdcllc commented Jul 29, 2015

Paul,

I had a fresh install of Visual Studio.NET 2013 and Visual Studio.NET 2015 when I encounter the issue. I hope this helps.

@paulvanbrenk
Copy link
Contributor

@kdcllc In which order did you install VS and the TypeScript packages?

@kdcllc
Copy link

kdcllc commented Jul 29, 2015

Paul,

I don't remember the complete installation procedure I followed but from the log it see that TypeScript tooling for VS.NET 2015 was installed first then VS.NET 2013.

I hope this helps.

@paulvanbrenk
Copy link
Contributor

Thanks I'll see if that makes a difference

@paulvanbrenk
Copy link
Contributor

This is fixed in TS 1.5 both for VS 2013 and VS 2015.

If you have the same issue with 1.5 please re-open.

@danmarshall
Copy link
Author

@paulvanbrenk nice!!

@j3ebf
Copy link

j3ebf commented Aug 22, 2015

I am having these exact issues. No matter what I do VS will not let me compile my Typescript.
And when I write 'tsc -v' in the package manager console it always writes 1.0.3.0.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 23, 2015

@j3ebf what version of vs and what version of type script are you using?
The issue you are seeing is because your path environment variable has tsc from 1.0.3 listed first. Manually edit your path variable and remove 1.0 but leave the version you want to use.

@j3ebf
Copy link

j3ebf commented Aug 31, 2015

I am using vs2013 community. And my Typescript version is 1.5.
I tried what you asked and it worked like a charm! Thanks :)

@rhythmnewt
Copy link

I've just had this issue occur on the hosted build service.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets(103,5): error : Your project file uses a different version of the TypeScript compiler and tools than is currently installed on this machine. No compiler was found at C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.4\1.4\tsc.exe. You may be able to fix this problem by changing the element in your project file.

Using TS 1.4 and all the symptoms are to the T matching the issue that's supposed to be fixed in the blog below.

http://blogs.msdn.com/b/vsoservice/archive/2015/07/27/type-script-issues-with-visual-studio-online-build-controllers-7-27-investigating.aspx

@2MmYxoeg
Copy link

2MmYxoeg commented Sep 1, 2015

I'm also experiencing this. I have also posted on Stack Overflow here:

http://stackoverflow.com/questions/32325894/error-during-vso-asp-net5-ci-build-your-project-uses-a-different-version-of-t

I have also linked back to this page.

@TheShmoe
Copy link

TheShmoe commented Sep 1, 2015

This also started occurring for me this morning. My CI builds were running fine yesterday, and the last successful build finished at 5:03:13 PM (Eastern Time) on 8/31/2015. This was my last build of the day, so I can't give any more insight as to when the build stopped working, just sometime between then and 9:00am this morning, but from @dimkanewtown's post, it appears to have stopped working as of 11:30pm on 8/31/2015. Hope this info helps! (I'm using VS 2015 Enterprise, and my projects are using ASP.Net 4.5)

@mhegazy
Copy link
Contributor

mhegazy commented Sep 1, 2015

We have contacted the VSO team and they are aware of the issue and working on a fix.

@bryanmacfarlane
Copy link

The VSO team is updating the image. The reason it regressed was order of VS installs and TS updates on the hosted image

@rhythmnewt
Copy link

thanks for the update. adding the below command to the msbuild arguments helped me get past the problem /p:TscToolExe="..\tsc.exe"

@bryanmacfarlane
Copy link

VSO should be good now. You should be able to remove the workaround

@rnetdev6
Copy link

I have both VS2012 and VS2013 on my system. after installing typescript 1.5. if i do tsc -v, i get 1.0.3.
@mhegazy - you said to edit environment path manually. Can you tell the location of the path.

is it C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript\Microsoft.TypeScript.targets

I changed to 1.5. still it's not working. Need help.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 14, 2015

tsc.exe should be in %programfiles(x86)%\Microsoft SDKs\TypeScript\<version>\tsc.exe where version is 1.6 for instance.

@rnetdev6
Copy link

I have 1.5. Installed typescript globally(npm install -g typescript). In cmd (tsc -v), i get 'tsc' not recognized as internal.. after deleting typescript/1.0 folder

. I am trying to setup VS 2013, typescript ans tsd.. having hard time.

@mhegazy
Copy link
Contributor

mhegazy commented Sep 14, 2015

@rnetdev6 TypeScript 1.0 setup used to add tsc.exe to the path. we stopped doing that since. so if you want tsc to be visible everywhere, add it to your path (e.g. setx path "%path%;C:\Program Files (x86)\Microsoft SDKs\typescript\1.5\"). if you want to use the npm package instead, then set the path to include your node package location.

@rnetdev6
Copy link

Thanks @mhegazy . It's working. I need this change for Visual Studio Code.

@paulici12
Copy link

copy 1.4 folder within the 1.4 folder, and it will work. tried the other workarounds suggested above with no luck. this bug is still present at the date of writing 21.jan.2016

@paulvanbrenk
Copy link
Contributor

@paulici12 is 1.4 the only version of TypeScript you have installed?

@paulici12
Copy link

1.0, 1.1, 1.4, 1.5, 1.7. I've seen this on both 1.4 and 1.5

@paulvanbrenk
Copy link
Contributor

What's the version of C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript\TypeScript.Tasks.dll and C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\TypeScript.Tasks.dll?

@paulici12
Copy link

I'm at home right now, and I'm having this issue on my work computer. I'll check it out, and post it back tomorrow.

@paulici12
Copy link

v12.0\TypeScript\TypeScript.Tasks.dll : 12.17.40.24720
v14.0\TypeScript\TypeScript.Tasks.dll : 12.17.40.24720

these are the product versions displayed under details in the file preferences tab.
I'm not sure if this is what you were requesting. Let me know if it was something else.

@paulvanbrenk
Copy link
Contributor

Yes, those were the versions I needed.

Can you create a sample project and share that on onedrive/dropbox, I have some trouble reproducing.
And which version of VS do you see this on?

@paulici12
Copy link

I'll send you a link to a dropbox zipped file, on monday when I get back to the office. I've seen this on VS2013. I have VS2012 and VS2015, but I've since applied the fix I wrote about, so I don't know where else this issue might be manifesting. I'll remove it on monday, and try it out in the other VS versions as well.

I live in Denmark at GMT+1, so I'm guessing there's a timezone gap between us, which might be hindering communication on a more regular basis, but I'll try to post as soon as I can.

@paulici12
Copy link

VS2013 is the only one producing the error. I tried 2012 and 2015 and they compile just fine.

vs2013.zip

@paulvanbrenk
Copy link
Contributor

I think I have a fix which should go into 1.8 final.. however, in the mean time. Can you check the Microsoft.TypeScript.targets files in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript and see if there is a TscToolPath element, which appends the TypeScriptToolsVersion. Removing the TypeScriptToolsVersion from that element should fix the issue.

@paulici12
Copy link

Hey Paul, there WAS a toolsversion appended to the toolpath in v12.0, and removing it DID fix the issue, so kudos to you! The advice further up suggests the same thing, but for v14.0. I didn't think about trying v12.0 instead. Thanks for helping me get to the bottom of this, and I hope your 1.8 fix will work for everyone.

@defyjoy
Copy link

defyjoy commented Mar 6, 2016

This is getting me crazy .. I dont have typescript 1.5 in my path . I added the 1.8 path manually but when I go to visual studio command prompt and type where tsc it gives me this --

image

How to get rid of that 1.5 ? It's not in the path variable .. Neither in user nor in system .

@mhegazy
Copy link
Contributor

mhegazy commented Mar 7, 2016

@defyjoy this is tracked by #4971. sorry for the trouble. As a work around please follow the steps in #4971 (comment)

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests