TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

Cannot publish when using single file output via TypeScriptOutFile

Open mykohsu opened this issue 10 years ago • 13 comments

Copying file Scripts/compiledFromTS.js to obj\Release\Package\PackageTmp\Scrippts\compiledFromTS.js failed. Could not find file 'Scripts/compiledFromTS.js'.

This is because the individual js files are not generated with single file output. The single output is also not published.

Probably related to https://github.com/Microsoft/TypeScript/issues/3178

mykohsu avatar Jan 13 '16 16:01 mykohsu

what version of TS are you using? if you are using 1.7.4, is it the same issue as https://github.com/Microsoft/TypeScript/issues/5894?

mhegazy avatar Jan 13 '16 22:01 mhegazy

I'm using 1.7.6 with VS 2015. I can verify that ItemGroup's Content Include is using relative paths, not absolute like in https://github.com/Microsoft/TypeScript/issues/5894.

mykohsu avatar Jan 15 '16 20:01 mykohsu

@mykohsu can you share your repro?

mhegazy avatar Jan 15 '16 22:01 mhegazy

Unfortunately the repro is internal only so may be difficult to reproduce. Weirdly, this is now working - I suspect there was conflict with a gulp script.

However, is it a known issue that the single file output is not published unless that target file is also added to the project? Is this the desired behavior?

mykohsu avatar Jan 16 '16 03:01 mykohsu

This may be related to the following:

Can you try the following in the TypeScript targets file for VS 2015 (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript), can you change the following line:

<TypeScriptBuildConfigurations Condition="'$(TypeScriptOutFile)' != ''">$(TypeScriptBuildConfigurations) --out &quot;$(TypeScriptOutFile)&quot;</TypeScriptBuildConfigurations>

to

<TypeScriptBuildConfigurations Condition="'$(TypeScriptOutFile)' != ''">$(TypeScriptBuildConfigurations) --outFile &quot;$(TypeScriptOutFile)&quot;</TypeScriptBuildConfigurations>

I changed --out to --outFile

paulvanbrenk avatar Jan 19 '16 21:01 paulvanbrenk

@mykohsu any updates on this issue? did the workaround help?

mhegazy avatar Feb 20 '16 00:02 mhegazy

I have the same issue where I am using typescript 1.8.6 with a tsconfig file specifying an outFile. This workaround didn't help.

What I did in the end is to add a build condition around the ItemGroup that contains all of my TypeScriptCompile elements to limit it to Debug mode. My publish settings are for a Release configuration and my ts outFile is included as part of the project so it gets copied on build.

Not ideal but it got me going.

<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <TypeScriptCompile Include="app\components\customer\app.ts" /> ... etc

firecube avatar Mar 23 '16 10:03 firecube

Closing this as it's unclear we can actually do anything here. We fixed the issue where specifying the outfile option in the tsconfig.json file would not work with publishing.

paulvanbrenk avatar Apr 11 '16 21:04 paulvanbrenk

@paulvanbrenk is there an update that will fix the TypeScript targets file without manually editing it?

brianj1084 avatar Apr 18 '16 14:04 brianj1084

@paulvanbrenk so, what's the solution.

jamesfancy avatar Jul 18 '16 10:07 jamesfancy

@jamesfancy for which question? The original bug is fixed in 2.0.

paulvanbrenk avatar Jul 18 '16 16:07 paulvanbrenk

@paulvanbrenk Thank you. I am waiting for 2.0 release.

jamesfancy avatar Aug 03 '16 06:08 jamesfancy

With 1.8.6, this will work if you use the project properties instead of using a tsconfig.json. It's not ideal but it works on a build server without modifying targets.

cwoolum avatar Aug 17 '16 23:08 cwoolum