Environment:
Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51209
I have a website project that contains some javascript files. Visual Studio minifies javascript files automatically -- for example, if the "source" file is called "myscript.js" -- Visual Studio will also create a minified version called: "myscript.min.js" -- which is great...
When I right-click on the file name in Solution Explorer and select "Publish myscript.js" - Visual studio publishes three files:
myscript.js
myscript.min.js
myscript.min.js.map
However, I want to publish ONLY the minified version of the file to the web site -- problem is, if I use the "Exclude From Project" setting (right-click on "myscript.js" -> Exclude From Project"); Visual studio will also exclude the minified version of the source file.
Is there a setting in Visual Studio that allows us to specify that only the minimized version of the file be published when selecting the "Publish" option within Solution Explorer???
PLEASE NOTE: I am NOT asking for an MSBuild or MSDeploy solution (this is NOT a web APPLICATION; it is a website project) -- I want to be able to publish a single file at a time (in this case javascript) but I do NOT want the main source file published -- only the minified version.
The only solution I have found is to manually publish the minified version, and then manually delete the "source" file from the web site; but it would be nice if Visual Studio had a setting that would prevent the javascript "source" file from being uploaded to the server.
Perhaps no such option exists? (Guess I am just looking for confirmation).
Thanks.
My advice would be to use Web Essentials (http://vswebessentials.com/) and go to Web Essentials => Edit Global JSCS Settings (.jscssrc) and add
"excludeFiles": ["scripts/myfile.js","app/services/*", "app/controllers/*"]
More info here: How can I configure Web Essentials 2013 to ignore files?
Related
This is about how to use Visual Studio 2017 with both Bundler and Minifier and also the "Visual Studio Installer Projects" extension.
My web app has only one main page, so the <script> tags are all there on one ASPX page, about 40 of them as there are 40 JS files. When I run bundler and minifier, I want one script tag to point to the bundled and minified JS which is now in one file (and CSS is also bundled from 7 files to one)
When running in release mode I want to use the bundled and minified version so its a simulation of what will be running when live.
When running in debug mode I want to use the unbundled files so I can debug the javascript in the IDE and see the CSS in f12 etc.
I think this means that my one page, a.aspx, has to have two versions ?
When building using the installer projects extension, I want to build only in release mode and that would be using the single bundled JS and CSS files, I don't want the other uncompressed javascript and CSS files shipping in the project even though I want them there when debugging.
How do we go about setting up a project to achieve this ? Is it even possible ? or do people write code to copy out the projects and edit the project files before compilation ?
thanks in advance
Is is possible to debug (breakpoints, watches) client-side .ts typescript files from visual studio (2015) directly? Most of the related issues that I have found on google and stackoverflow suggest using other browser devtools such as chrome. Is it possible to do it in visual studio?
When I create a .ts script (say index.ts), it will be transpiled into a index.js which will then be referenced from the corresponding index.html file in the script tag.
How can I set breakpoints in the .ts file (although it is the .js which is referenced?)
It is possible with IE. You have to set "Browse with" to Internet Explorer and in the project properties/web unchecked all debuggers. Than you should be able to debug client-side TS in VS.
I figured out that I can debug in visual studio but launching a a new debug session from internet explorer: menu->view->external script debugger which will start a new visual studio ide with all my files (.js and .ts mapped) loaded. I just have to make sure that the .js and .ts files are in the same directory (example: ./public/js/ ). It is not a perfect solution (for example bringing the cursor over a variable does not show the variable value. You must manually open the watch window...) But it allows me to step through my .ts files thus keeping a unified development environment: typescript with node.js on the server, typescript on the client-side within the same solution
You might try with this HTML Application with TypeScript project template from Web Essentials 2015 extension, as suggested in this post from Telerik blog.
If that works, it seems just a matter of usual VS scenario "set breakpoint; hit F5".
I have lost the support for JavaScript files inside Visual Studio 2015 after updating the TypeScript tools from version 1.5.3 to 1.5.4.
By support for JavaScript I mean intellisense, syntax coloring and the JavaScript options inside Options menu -> Text Editor.
My js files look like txt files now.
I have already tried many things:
The steps in this answer: Visual Studio 2015 CTP - Javascript support missing
Repair TypeScript Tools
Repair Microsoft Asp.Net and Web Tools 2015
Repair entire Visual Studio 2015
Nothing worked.
Does anyone knows a solution for this problem?
This is a known bug that we have fixed in VS 2015, however you could have been affected if you installed the "Universal Windows App Development Tools" during a specific period of time. We will soon be publishing a KB with the following workaround:
If the “Universal Windows App Development Tools” are still installed:
Go to Programs and Features, select Visual Studio 2105, click Change.
In Visual Studio setup, click Modify.
Deselect the feature “Universal Windows App Development Tools”
Select “Universal Windows App Development Tools” again, and click Update.
If you have already uninstalled the “Universal Windows App Development Tools”:
Reinstall “Universal Windows App Development Tools”
Or, take the following steps to reinstall the JavaScript project system and language service:
Download the installer for your edition of Visual Studio, e.g. vs_community.exe.
Open a CMD window, and run the following command: vs_community.exe /modify /installselectableitems JavaScript_Hidden /passive
Sorry for the trouble. Hope that helps.
Found a workaround to rollback to TypeScript 1.5.3 and get back support for JS:
From Programs and Features, uninstall TypeScript Tools 1.5.4 and Microsoft Asp.Net and Web Tools 2015
Download VS 2015 offline installer (Reference: How to install VS2015 Community Edition offline)
Inside the download directory from step 2, navigate to "packages\WPT" and install "webtoolsextensionsvs14.msi" (Microsoft Asp.Net and Web Tools 2015)
Then navigate to the folder (inside the download directory) "OfflineCache\installers". You will see two TS folders: "TypeScriptV1" and "TypeScriptV2". They are the installers for the versions 1.5.3 and 1.5.4 respectively.
Install TypeScript Tools 1.5.3 (using the installer inside the folder "TypeScriptV1")
Now, start Visual Studio. At this point JavaScript support should be back, and TS support still available.
NOTE: there is no independent installer for TypeScript Tools for VS 2015 (Reference: Typescript 1.5 for VS2015 without internet access)
UPDATE:
As Mohamed Hegazy noted, the TypeScript installers are available to download on: TypeScript for Visual Studio 2015
In my case, here is the way I fixed it:
Tools > Options > Text Editor > JavaScript > Intellisense > References
Make sure you Implicit (Web) is selected under Reference Group
Make sure that ~/Scripts/references.js is added in the include files list
Hope it will help you
Using VS2013 Community Edition with Nodejs Tools for Visual Studio, the issue is that the intellisense for js files && classes is not working at all.
Dont have Resharper installed so it is not related to it.
I looked into text editor-> javascript -> auto list member is checked.
I also cannot add reference files to js files in a Project of type "From Existing Node.js Code" or "Blank Nodejs Web Application", also cannot create "_references.js" file neither through Web Essentials neither through Add -> Javascript Intellisense.
The project is front end running on node js.
Basically we use require js to load different modules (backbone : views, models etc ).
So as you see the intellisense it not working for this.getEmptyResponse.
https://trello-attachments.s3.amazonaws.com/54c0f5ffef5a644796f37cbc/851x222/4fb7e502f05f8b0ad01f2e58aee7241d/intellisense1.png
Also if i you require or define, it also doesnt show up anything.
And i cannot create javascript intellisense file either.
https://trello-attachments.s3.amazonaws.com/54c0f5ffef5a644796f37cbc/677x466/7e01ade2c13072a9ac8534ac90b7391d/intellisense2.png
Any help would be appreciated !!
How can I get JavaScript IntelliSense in Visual Studio 2008 and in Visual Studio 2010 ?
How can I get jQuery IntelliSense in Visual Studio 2008 and in Visual Studio 2010 ?
If I fail to get the above, let me know 'Which is the most used JavaScript Editor which can replace VS versions for editing javascript files?
or you can simply drag and drop your javascript into your .js file and it creates entry like this:
/// <reference path="jquery-1.6.2.js" />
worked fine on my VS 2010 (Premium version)
I'm using VS2010 with ReSharper 6 which adds powerful JS Intellisense support. Autocomplete works for all JS files in the solution as well as jQuery. But it's not free.
Go to Tools-Options-Text Editor-Javascript-Intellisense-References and place a reference to the intellisense files for the version of jquery you are using in the Implicit Web group.
OR
place an "add reference" to the intellisense file in the _references.js file which you can add to the Scripts folder of your project.
/// <reference path="jquery-1.8.2.js"/>
/// <reference path="jquery-1.8.2.min.js"/>
/// <reference path="jquery-1.8.2.intellisense.js"/>
Though this will only provide intellisense for the project you are in, the first will for any open js file.
To get the latest jquery files with intellisense use the nuget package installer which by default will create a scripts folder and place the jquery version.js, the min.js and intellisense.js files into... from there you can copy them to the location most of the Microsoft references are placed which is typically
C:\Program Files (x86)\Microsoft Visual Studio 11.0\JavaScript\References
VS 2008/2010 has built in JavaScript IntelliSense.
If you have the corresponding "-vsdoc.js" file next to your jQuery file VS 2010 offers IntelliSense out of the box and VS 2008 needs SP1 installed and the patch at http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736
No need, really.
http://archive.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736
Wow... I followed the method described above.. Awesome....
You should get the jQuery files from Asp.Net CDN. They have VSDOC and are able to give very good intellisense and documentation support.