2

I'm working on a large single page application developed using TypeScript, KnockoutJS & RequireJS.

I've two projects Project 1 : Core application, which has all the modules and its files. Project 2 : Module project, which is spitted from Project 1.

What I want to do is to include the required .ts files in Project 1 to Project 2

I have a lot of file to be referenced, So i need to add the .ts files recursively.

I've tried adding the required .ts files using Add-as-link option in Visual Studio. Then I tried the ways below to copy them during building the project.

  1. Target Copy task option in MSBuid in the project. As show here
  2. As show here, using the <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> option.

Both didn't work as I expected.

MSBuild task snippet pasted below,

 <Project>
   ...
   <ItemGroup>
      <!-- Typescript files from the core project -->
      <TypeScriptCompile Include="..\Project1\Scripts\**\*.ts">
         <Link>scripts\%(RecursiveDir)%(FileName)%(Extension)</Link>
         <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      </TypeScriptCompile>
      <!-- Typescript files specific to the module project -->
      <TypeScriptCompile Include="scripts\src\module\js\sub-module.ts" />
      <TypeScriptCompile Include="scripts\src\module\js\helpers.ts" />
   </ItemGroup>   
 </Project>

Please help me out the correct way to copy the required .ts files to the sub project.

Bram
  • 57
  • 1
  • 12
Rahmathullah M
  • 2,526
  • 2
  • 24
  • 42

0 Answers0