1

In visual studio, I can add .ts files to the project, and select typescript compile as the build action. Nice.

But the resulting .js file is not copied to build folder, regardless of the Copy to Output Directory option. Neither is the original ts file by the way.

How does one compile and copy the resulting file to the build folder?

Just for context, I need to read those files as text to send to a testing browser.


I have made it work by adding the js file to the project and setting copy to output on that file, but is there any guarantee that the ts file will be compiled before the js file is copied? I am down to checking every time, but there has to be a way.

3
  • Similar question here, but it is mostly about why this happens than how to solve it, and there is no answer Commented Feb 20, 2018 at 16:18
  • Use a tsconfig.json and set "outDir" Commented Feb 20, 2018 at 22:54
  • I'd have to add both debug and release folders, is that even possible? Commented Feb 21, 2018 at 9:53

1 Answer 1

0

May be my answer comes late but here is how you can do: open your project file and set the output dir

<PropertyGroup>
  [...]
  <TypeScriptOutDir>bin\$(Configuration)\</TypeScriptOutDir>
  [...]
</PropertyGroup>

Make sure the PropertyGroup doesn't have any condition ; for eg. <PropertyGroup Condition="'$(Configuration)' == 'Xyz'">. If so, you can add another PropertyGroup

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.