I'm using Angular 2 in my web project, and as such need TypeScript to suport experimental decorators such as #View. This can be done in tsconfig.json with "experimentalDecorators": true but I see no such option in Visual Studio's project settings. (I created a TypeScript Project.) As such, I need Visual Studio to detect and use my tsconfig.json file.
I've read various places online that Visual Studio should pick up and use a tsconfig.json if it's present in the project's root directory. However this is not happening. I am using Visual Studio 2013 Update 4 -- and upgrading to Update 5 as I write this.
Does anyone know how to get Visual Studio 2013 (NOT Visual Studio Code, and NOT Visual Studio 2015) to use the tsconfig.json file? Maybe it needs to be in the solution's root instead of the project's root?
Failing that I can try adding a pre-build event to call tsc directly... but that seems sloppy.
I also was looking for this. It appears that Visual Studio 2013-2015 not support tsconfig.json yet. Currently you need to edit your project file.
Edit: With Typescript 1.8 release Visual Studio 2015 seams to fully support .tsconfig. See http://www.typescriptlang.org/docs/release-notes/typescript-1.8.html
The following question: What are the TypeScript project build configuration options? points to a .targets file where the TypeScript configuration options are defined.
You could manually modify that .targets file to add support for experimentalDecorators, although that's not scalable because you'd have to do that to each developer's machine.
Related
I'm using Visual Studio 2015 Enterprise Edition. I followed this tutorial
https://www.youtube.com/watch?v=IgvbhyDh8r0
Like Visual Studio creates a .sln file when any new project is saved and then on building it executes it to build the project, in the case of this VTK tutorial, it uses CMake to create the build file .sln for Visual studio to execute. Is there any way I can automate/replace the process of CMake using Visual Studio only?
PS- Just ignore if I have any misunderstanding of the concepts as I'm totally new to this and was not able to find proper documentation on it.
After you've generated a .sln file once, you don't need to run CMake manually again. It hooks itself into ZERO_CHECK project, so it would regenerate the solution every time you change CMakeLists.txt.
But you can't do with VS only, as you have to generate .sln for the first time.
I'm trying to use SystemJS modules in Visual Studio 2013 with TypeScript, but Visual Studio shows errors.
This is my setup:
Installed TypeScript Tools for Microsoft Visual Studio 2013 1.8.5.0
Uninstalled lower versions of TypeScript
Project file (VS 2013 does not support tsconfig.json):
<TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>
<TypeScriptModuleKind >system</TypeScriptModuleKind>
<TypeScriptTarget>es5</TypeScriptTarget>
This is what I see:
My project compiles successfully
In the browser, AngularJs runs successfully
But in Visual Studio, I see squiggly lines. Upon hovering it says 'expression statement is not assignment or call':
This issue is related to this question, however, the answer there is 'use VS 2015', which simply is not an option for me.
Is there any way to use SystemJS with TypeScript in Visual Studio 2013? It doesn't have to be ES6-style modules, just any combination of SystemJS and TypeScript will do. Thanks!
I don't know if you already tried to set SystemJS as module system in the preferences:
If still doesn't work, try to follow this guide: http://www.codeproject.com/Articles/1060262/First-Angular-App-with-TypeScript-and-Visual-Studi
from "Setting Up Visual Studio Project".
By the way, VB 2013 is a very old version of the software, is there any reason why shouldn't you migrate to a newer version?
It seems that there just isn't a solution for this. Upgrading to VS2015 is the only way to fix it.
You may need --allowSyntheticDefaultImports if angular doesn't have a default export.
How do I open I a Visual Studio Code folder in Visual Studio 2015?
If I open it as a "Web Site", it tries to treat the node_modules directory as part of the project's normal JavaScript files and hits an error when the path exceed the maximum path length.
But I can't open it as any other project type unless I first create a project of that type and then move all the VS Code files into that folder.
Should I be trying to open it as a web site?
Or should I create a new project and then copy the files + folders into it?
Is there any advantage to having it as a project?
If I do create a project, it makes it difficult to work together with someone who is just using VS Code?
And if I use a project, which project type should I select?
Finally folder view has arrived in VS 2017 :)
You can find more details in here.
Currently there is no way to open a folder directly with Visual Studio.
Why? Because Visual Studio and Visual Studio Code only shared their name, not the idea behind it. To extend Jenny O'Reilly answer:
Visual Studio Code is a folder oriented editor
This means VSC has the same Point-of-View to your Project as the File Explorer.
Visual Studio (not Code) is a solution oriented integrated development environment (short IDE)
Instead every Project in Visual Studio needs a *.sln Solution-File as Root Component. From this point Visual Studio looks at your Project. An example would, if you copy File in your Project Folder, they wouldn't be recognized from Visual Studio. You have to add them first to your sln File, to see them. It also allows the developer to combine multiple projects (*.csproj,..) into one single Solution to build.
This means the idea behind these two editors is completely different.
Visual Studio (not code) Project-types for Web
There are Node.js Tools for Visual Studio
This will provide Node.js built-in project templates
Visual Studio 2015 comes with TypeScript templates
Workaround 1
A workaround would be a Blank Solution in which you set up your Visual Studio Code Project.
Workaround 2
Another trick would be the answer to this question. You can open your Project Folder as a Website Project.
File -> Open Website -> File System and choose the folder
Update
As you mentioned, there will be errors because Visual Studio tries to build the solutions. For the next few readers of this response, the work around for this (as John Pankowicz writes in the comment) is:
Right-click Web Site in Solution Explorer -> Property Pages -> Build -> Uncheck "Build Web Site as part of solution"
Update 2
(Thanks to JC1001 for this update)
The next version of Visual Studio (Visual Studio "15") will support opening a folder. This is mentioned in the Visual Studio Blog.
Also like in Visual Studio Code, there will be a prompt command for opening Folders. Right now you can use this in the preview version:
devenv /command “file.openfolder FOLDER_PATH”
In the future you will be able to use:
devenv FOLDER_PATH
Opinion
Personally I wouldn't recommend Visual Studio (not code) for HTML/Website projects without server-side-development, because I don't see any features. Even the intellisense suggests to me sometimes bad HTML Code (it's not the IDE's fault).
After all web projects are still text files. You can easily control group projects like this with Version Control. Visual Studio Code even provides an integrated Git support.
Visual Studio Code does not create "project files" that you can open in Visual Studio 2015. Basically, when you open up a Node website in Visual Studio, you need to re-create the folder structure in VS2015 and create a "project file".
I haven't seen any better ways of doing this, but will be happy when we can open a folder just as easilly as we can with VSCode
I'm sure it's not the best way but..
Open an existing .sln with notepad, change the names, save as [name of your project].sln.
Open with Visual Studio.
I have a visual studio solution with a a vs2010 project
Everytime I open it I got this warning.
Visual Studio needs to make non-functional changes to this project in
order to enable the project to open in this version and Visual Studio
2010 SP1 without impacting project behavior.
ANd it generates some xml log files
I need to definitely convert it to vs 2012
How can I do that without breaking anything else?
I was able to solve it by opening the .csproj file and changing this
<FileUpgradeFlags>0</FileUpgradeFlags>
for this
<FileUpgradeFlags></FileUpgradeFlags>
I have a csproj file which references a shared MSBuild script with an <Import> directive. I have noticed that when I change the shared script, I need to close and reopen Visual Studio before it notices the change - a build within Visual Studio notices changes to the csproj file but not the shared file.
This doesn't happen when I build the project with MSBuild from the command line. Is Visual Studio caching the imported script? If so, why? And how can I turn off this behaviour which makes authoring build scripts hard / impossible using Visual Studio?
Thanks!
Instead of closing and re-opening Visual Studio have you tried, unloading and reloading the project (.csproj) which imports the shared script? You can do this from the Solution Explorer in Visual Stduio by right clicking on the loaded project and selecting unload and then on the unloaded project and picking load.
In my experience, Visual Studio 2015 behaves better than Visual Studio 2008.
VS picks up changes from imported files in most cases, at least for C# projects.
YMMV for other project types, though.
While the solution explorer doesn't reflect changes, the build uses the updated version of the import file.
So, the solution may be to use a more recent version of Visual Studio.