Pregunta

I am working with TypeScript across multiple projects. We have a "Core" API which other projects use.

For Development, I wanted to use Reference Paths. So in ProjectB I went to:

Right Click Solution > Add Existing > c:/projectA/myfile.min.js

But when I run my solution, the reference paths are not copied to IIS. Basically, "myfile.min.js" cannot be found.

This makes sense because I guess IISExpress is treating c:/projectB/ as a root directory. And since the Reference Path is actually a blank folder.... C:/projectA/ exists out of scope.

How can this be solved?

Note: Our production version is fine. It is more for easier Dev.

¿Fue útil?

Solución

To debug my solution I done this way.

In ProjectAPI.proj
<Project>
...
 <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
   <TypeScriptTarget>ES5</TypeScriptTarget>
   <TypeScriptIncludeComments>true</TypeScriptIncludeComments>
   <TypeScriptSourceMap>true</TypeScriptSourceMap>
   <TypeScriptOutFile>js\Base.js</TypeScriptOutFile>
   <TypeScriptModuleKind>none</TypeScriptModuleKind>
   <TypeScriptSourceRoot>$(ProjectDir)js/</TypeScriptSourceRoot>
   <TypeScriptMapRoot>$(ProjectDir)js/</TypeScriptMapRoot>
 </PropertyGroup>
 <PropertyGroup>
   <PostBuildEvent>
     if $(ConfigurationName)==Debug copy "$(ProjectDir)js\Base.js" "$(ProjectDir)..\..\..\Shared\"
     if $(ConfigurationName)==Debug copy "$(ProjectDir)js\Base.js.map" "$(ProjectDir)..\..\..\Shared\"
   </PostBuildEvent>
 </PropertyGroup>
</Project>

In PojectWebSite.proj
<Project>
...
 <PropertyGroup>
   <PreBuildEvent>
     if $(ConfigurationName)==Debug copy "$(ProjectDir)..\..\..\Shared\Base.js" "$(ProjectDir)js\"
     if $(ConfigurationName)==Debug copy "$(ProjectDir)..\..\..\Shared\Base.js.map" "$(ProjectDir)js\"
   </PreBuildEvent>
 </PropertyGroup>
 </Project>

TypeScriptMapRoot was the secret to discover.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top