Hiding generated js files in Visual Studio 2017 - visual-studio

How would I be able to hide generated js files (Transpiled from Ts files) in the solution explorer?
Lets say I have an angular website. I add this angular project to Visual Studio (Chose Visual Studio 2017 Enterprise as my code editor). There seem to be no straight forward way to hide these generated js files. The solution suggested by Hiding js files in visual studio looks very crude.
I am more into a solution similar to what has been suggested in
Hide .js.map files in Visual Studio Code but it appears to be only applicable to VS code. How can I achieves this in Visual Studio? Where can I see the work space related settings for an existing web-site (angular project) added in visual Studio?

Even through it is not exact answer to your question, I will recommend to not hide js files in particular editor, but organize project in the way, that compiled code located separate from source files. It is common to have src and dist folders inside your project. You can use outDir setting in tsconfig.json in order to achieve this.

Related

Generated T4 Files Not Added to Project from Visual Studio Extension

I am trying to generate code scaffolding for an in-house API. I created a T4 template which includes several other templates for each code file to be generated. I then wrote a Visual Studio Extension (VSIX) with a WPF form to capture user input and initiate the transforming of the T4 template. I am doing all of this in Visual Studio Professional 2013.
This is what I followed to Invoke the Text Transformation in a VS Extension
https://msdn.microsoft.com/en-us/library/gg586947%28v=vs.120%29.aspx?f=255&MSPPError=-2147217396
When testing the templates locally using Run custom tool, everything works perfectly. However, when testing the VS extension in an Experimental Instance of Visual Studio, the problem I am having is that after the transformation has been invoked [calling ITextTemplating.ProcessTemplate], the generated files are not placed into my open project. I verified that they exist in their appropriate folders in File Explorer.
I have searched high & low and can't find anything that talks about this. Any ideas?
The custom tool is using the Visual Studio API (DTE object) to add the generated files to the projects. I built something very similar and that is what I had to do. This project is a bit old but it is a great starting point for seeing how this can be done.
Basically you need to get a reference to the folder you want to add the new item to and then call AddFromFile. Also don't forget to save the project after you add all the items.

How do I manage Visual Studio file dependencies without editing the project file?

Whenever we want to make files in Visual Studio depend on another file, we have to edit the .csproj file and place the file in a <DependentUpon> element. Is there an extension or hidden feature that allows this to be done from within Visual Studio without editing the project file and reloading the project?
You have to edit the .csproj file to set up the dependency.
If you do this from within Visual Studio this will cause the project to be reloaded.
If you want to avoid reloads then you could edit the file outside Visual Studio (it's just xml) and then load it, but you would have to get the syntax correct. It's far simpler to let Visual Studio do its thing.

Type Script is not generating JavaScript in my Visual Studio Community edition 2015

I am using Visual Studio Community edition 2015 for development, I have added *.ts file to my project but its not automatically compiling. Also it does not show JavaScript preview pane. This post How do I enable the preview panel for TypeScript files in Visual Studio 2015? says that it's not supported anymore. That's fine, but why it's not compiling?
I referenced Missing Typescript Options in Web Essential for Visual Studio 2012
It says Split panes have been reintroduced in the latest version of web essentials http://vswebessentials.com/features/typescript but I can not see it
I do have typescript exe in following folder
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5
I do have settings in Project Properties as follow
I do have settings as follow in Visual Studio
I see comment in http://www.typescriptlang.org/ as below
"Visual Studio includes TypeScript in the box, starting with Visual Studio 2013 Update 2. You can also edit TypeScript in VS Code, WebStorm, Atom, Sublime Text, and Eclipse"
What may be issue?
Solution
My "typings" file for jquery was out dated, I upgraded it and it resolved other errors and build was success, then JS files got generated.
Below post helped
JQuery definition screwed up with TypeScript 0.9
I can not close this question because I am still not able to get 'Preview Pane"
I regularly encounter this issue in VS 2015 and VS 2013. My solution is not a pretty one, but it works for me...
Close Visual Studio
Go to your scripts folder, delete all JavaScript files that have corresponding TypeScript files (only necessary to do this for TypeScript files that you have created for your project)
Open Visual Studio, clean, and build
If this doesn't work, open each TypeScript file, change one character, Save, re-build... hopefully the file will re-compile.
If this still doesn't work, open a Node.JS command prompt, change directory to the scripts directory, run;
tsc "yourfile.ts"
If this doesn't work, you've got bigger problems.
Make sure that you highlight the project in the solution explorer and then click the icon at the top that says "show all files" after you have compiled the project. You will then see the .js and maybe a .js.map file (greyed out). Select the files and then right click and 'include in project' and things should be good from there.
Some false-errors in my ts caused the issue, fixed by uncheck "Do not emit outputs if any errors are reported"
(The false error is from an outdated DefinitelyTyped file, the generated js file does not have any error.)
Maybe not having the option to expand the .ts file and see the generated .js can cause a confusion here.Try to compile your solution. Click on Show All Files and you must see all the .js generated in the same folder of your .ts files. Include your .js in the project if you want to have them visible as part of the solutions. Hope this helps
I know you say you added the .ts file but did you right-click and select 'include in project'. This will add it to the list of files that Visual Studio will check for TypeScript transpiling.
You need install Web Essential then restart the Visual studio -> clean Solution -> Rebuild it should work.

VS2013 not adding Javascript generated from Typescript to project automatically

I'm using TypeScript for the first time. I'm using Visual Studio 2013 with update 4, Web Essentials with update 4, and have the latest version of TypeScript from Microsoft's website. However, following the tutorial doesn't work for me: when saving a TS file, it automatically compiles to JavaScript on the screen to the right of the code I typed, and a JS file is created in the folder. However, this file is not added to the project automatically. How can I set Visual Studio 2013 to automatically add generated JS files to the project?
How can I set Visual Studio 2013 to automatically add generated JS files to the project
Use a glob for your TypeScript folder i.e. modify your .csproj file to include:
<Content Include="client-src\**\*.*">
</Content>
Besides Basarat's answer which works, there's also another solution: not doing anything. TypeScript generates a JavaScript file, which automatically gets placed in the same folder as the TypeScript file. When in Visual Studio, right click the folder your TypeScript file is in, and select "open folder in file explorer". You should see that the folder holds both the TS file you made, and the JS file that got generated.
You do not need to add this JS file to your project folder inside Visual Studio: you can just reference it. If you have an MVC project with a Scripts folder that has a file called greeting.ts (the one you make in the TypeScript tutorial), the path would be "~/Scripts/greeting.ts". Instead, just use "~/Scripts/greeting.js" (ending with js instead of ts). Visual Studio is smart enough to figure it out from there. This works with bundles as well.

Visual Studio 2010 as simple web site editor

Is it possible to use Visual Studio 2010 as a simple web site editor (HTML + JavaScript; no ASP.NET)?
VS only supports known project file types (i.e. .csproj), so I started with a C# project and I've been fiddling with the file, but VS still keeps creating .vshost files and obj directory.
Can I force it not to do this?
See Previous Question
Visual Studio Web Development is orientated to ASP.NET projects creation, but you can build without any problem, HTML & JS applications deleting the extra directories created for ASP.NET apps, which need that.
Maybe using Visual Web developer
http://technet.microsoft.com/en-us/query/9z74w20y
You can add "Project Folders" to a empty project / solution and add the files into the folders without any project "overhead" .. intellisense works fine ..

Resources