Skip to content

Backslash in reference path causes Visual studio 2013 to drop js in wrong directory #2152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
glaborde opened this issue Feb 26, 2015 · 9 comments
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@glaborde
Copy link

Select Redirect Javascript output to directory.
Create ts with reference to another ts using backslash for path.
Build.Look for resulting javascript file in windows explorer.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 26, 2015

I will need more information to be able to reproduce this issue locally.

here is my setup:

output directory: "out"

// file1.ts
var f1 = 1;
// file2.ts
/// <reference path="c:\users\mhegazy\documents\visual studio 2015\Projects\TypeScriptHTMLApp3\TypeScriptHTMLApp3\file1.ts" />
var f2 = 2;

after build, i see out to include file1.js and file2.js

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Feb 26, 2015
@glaborde
Copy link
Author

glaborde commented Mar 5, 2015

Hello Mohamed,

sorry for not getting back sooner on this.
I spent a little more time to characterize this problem. We actually had
made two changes to try to fix this problem. One was the backslash. The
other was to move the ts file to the root of the project (which
incidentally is the fix that worked).

The problem is that the reference path is also the relative location to the
resulting js file.
For example, redirecting Javascript output to Resources, if I put my
typescripts in a sub directory (scripts\mystuff), the javascript drops
under: Resources\scripts\mystuff.

By putting the scripts on the root, the resulting javascript drops under
Resources as expected. Forward slash versus backslash doesn't affect this
behavior.

I am looking for a behavior where the compilation outputs are dropped in a
single location irrespective of the relative location of the typescripts.

What do you think?

Guy

On Thu, Feb 26, 2015 at 10:53 AM, Mohamed Hegazy [email protected]
wrote:

I will need more information to be able to reproduce this issue locally.

here is my setup:

output directory: "out"

// file1.tsvar f1 = 1;

// file2.ts/// var f2 = 2;

after build, i see out to include file1.js and file2.js


Reply to this email directly or view it on GitHub
#2152 (comment)
.

@mhegazy
Copy link
Contributor

mhegazy commented Mar 8, 2015

The output folder structure is dependent on the "best common path" of the input. I think what you want is a --projectRoot or --commonSourcePath option to force the compiler to generate outputs to mirror a specific input folder structure.

@mhegazy mhegazy added Suggestion An idea for TypeScript and removed Needs More Info The issue still hasn't been fully clarified labels Mar 8, 2015
@glaborde
Copy link
Author

Hello Mohamed,

what I am looking for is a single output directory (Resources) in which all
the javascripts would be created. No sub directories. What you are
describing is I think the current behavior. The output directory is in
reality the root for the output and not the output directory.

Does that make sense?

Guy

On Sun, Mar 8, 2015 at 1:06 PM, Mohamed Hegazy [email protected]
wrote:

The output folder structure is dependent on the "best common path" of the
input. I think what you want is a --projectRoot or --commonSourcePath
option to force the compiler to generate outputs to mirror a specific input
folder structure.


Reply to this email directly or view it on GitHub
#2152 (comment)
.

@mhegazy
Copy link
Contributor

mhegazy commented Mar 10, 2015

when you call the compiler with --outDir outputDirectoryPath, it tries to miror the inpyt directory structure under outputDirectoryPath.
The trick here is to figure out the "root" of the input. so if you have this directory structure:

folder1
|- a.ts
|- folder2
   |- b.ts
   |-c.ts

calling the compiler with ` b.ts c.ts --outDir outputDirectoryPath

@mhegazy
Copy link
Contributor

mhegazy commented Mar 10, 2015

When you call the compiler with --outDir outputDirectoryPath, it tries to mirror the input directory structure under outputDirectoryPath.
The trick here is to figure out the "root" of the input. so if you have this directory structure:

folder1
|- a.ts
|- folder2
   |- b.ts
   |- c.ts

Calling the compiler with b.ts c.ts --outDir outputDirectoryPath, will result in a common directory of folder1\folder2 and in turn will generate this output folder structure:

outputDirectoryPath
|- b.ts
|- c.ts

adding a.ts to the input a.ts b.ts c.ts --outDir outputDirectoryPath, will result in a making the common directory of folder1 and in turn will generate this output folder structure:

outputDirectoryPath
|- a.ts
|- folder2
   |- b.ts
   |- c.ts

I think what you need, is a way to tell the compiler, regardless of my inputs, always consider folder1 as my input root, and generate the output accordingly.

@liciniomendes
Copy link

Would be nice allow VS macros for build commands.

The result would be something like $(ProjectDir)outputDirectoryPath on textbox.

@mhegazy
Copy link
Contributor

mhegazy commented Jul 31, 2015

@licinioamendes i have logged #4109 to track that issue.

@mhegazy
Copy link
Contributor

mhegazy commented Dec 10, 2015

this is addressed by --rootDir: #2772

@mhegazy mhegazy closed this as completed Dec 10, 2015
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Dec 10, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants