<p dir="auto">Hi,</p>
<p dir="auto"><strong>Version</strong>: VS 2015 / TS 1.5.4</p>
<p dir="auto">To reproduce:</p>
<ul dir="auto">
<li>
<p dir="auto">Set <code class="notranslate">"Redirect JavaScript output to directory"</code> to say <code class="notranslate">bin</code>.</p>
</li>
<li>
<p dir="auto">Set <code class="notranslate">"Generate declarations files"</code>.</p>
</li>
<li>
<p dir="auto">Set <code class="notranslate">"Compile on save"</code>.</p>
</li>
<li>
<p dir="auto">Add file <code class="notranslate">_references.ts</code> to the project, with content</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/// &lt;reference path='../../foo/bar1/bin/bar1.d.ts' /&gt;
/// &lt;reference path='../../foo/bar2/bin/bar2.d.ts' /&gt;"><pre class="notranslate">/// &lt;<span class="pl-ent">reference</span> <span class="pl-e">path</span>=<span class="pl-s"><span class="pl-pds">'</span>../../foo/bar1/bin/bar1.d.ts<span class="pl-pds">'</span></span> /&gt;
/// &lt;<span class="pl-ent">reference</span> <span class="pl-e">path</span>=<span class="pl-s"><span class="pl-pds">'</span>../../foo/bar2/bin/bar2.d.ts<span class="pl-pds">'</span></span> /&gt;</pre></div>
</li>
<li>
<p dir="auto">Build the project and check the output directory. The content of <code class="notranslate">_references.d.ts</code> should be</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/// &lt;reference path=&quot;../../../foo/bar1/bin/bar1.d.ts' /&gt;
/// &lt;reference path=&quot;../../../foo/bar1/bin/bar2.d.ts' /&gt;"><pre class="notranslate">/// &lt;<span class="pl-ent">reference</span> <span class="pl-e">path</span>=<span class="pl-s"><span class="pl-pds">"</span>../../../foo/bar1/bin/bar1.d.ts' /&gt;</span>
<span class="pl-s">/// &lt;reference path=<span class="pl-pds">"</span></span>../../../foo/bar1/bin/bar2.d.ts<span class="pl-s"><span class="pl-pds">'</span> /&gt;</span></pre></div>
</li>
<li>
<p dir="auto">Now modify one file in the project and trigger <code class="notranslate">compile-on-save</code> by saving the file. Now the content of the same file should have changed to</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/// &lt;reference path=&quot;d:/x/y/z/foo/bar1/bin/bar1.d.ts' /&gt;
/// &lt;reference path=&quot;d:/x/y/z/foo/bar1/bin/bar2.d.ts' /&gt;"><pre class="notranslate">/// &lt;<span class="pl-ent">reference</span> <span class="pl-e">path</span>=<span class="pl-s"><span class="pl-pds">"</span>d:/x/y/z/foo/bar1/bin/bar1.d.ts' /&gt;</span>
<span class="pl-s">/// &lt;reference path=<span class="pl-pds">"</span></span>d:/x/y/z/foo/bar1/bin/bar2.d.ts<span class="pl-s"><span class="pl-pds">'</span> /&gt;</span></pre></div>
</li>
</ul>
<p dir="auto">This together with <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="99927238" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/4245" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/4245/hovercard" href="https://github.com/microsoft/TypeScript/issues/4245">#4245</a> appears to be a regression introduced in the fix for <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="96181777" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/3939" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/3939/hovercard" href="https://github.com/microsoft/TypeScript/issues/3939">#3939</a>.</p>
<p dir="auto">This is interfering with some systems we have in place.</p>
<p dir="auto">As reported by @licinioamendes  in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="59102033" data-permission-text="Title is private" data-url="https://github.com/microsoft/TypeScript/issues/2152" data-hovercard-type="issue" data-hovercard-url="/microsoft/TypeScript/issues/2152/hovercard?comment_id=126757495&amp;comment_type=issue_comment" href="https://github.com/microsoft/TypeScript/issues/2152#issuecomment-126757495">#2152 (comment)</a>:</p>
<blockquote>
<p dir="auto">Would be nice allow <a href="https://msdn.microsoft.com/en-us/library/c02as0cs.aspx" rel="nofollow">VS macros for build commands</a>.</p>
<p dir="auto">The result would be something like <code class="notranslate">$(ProjectDir)outputDirectoryPath</code> on textbox.</p>
</blockquote>
<p dir="auto">Also note that this is working in VS2013 but not in VS2015.</p>