Typescript Type Definition References - visual-studio

I have a project with multiple typescript files.
If I add a new typescript file I have to reference typings in order to compile it, VS couldn't resolve them itself. Also I have empty .ts file that doesn't require referencing typings, so I put code into it and it works.
When I found out it I kept the file and now when I need to create new .ts file, I copy that file and everything works like a charm.
So suppose in a folder I have two .ts files side by side: a copy of a magic file and a newly created one.
If I put this code in the magic file
class Test {
test: KnockoutObservable<string>;
}
it compiles. If I put the same code into another file it says
Cannot find name KnockoutObservable
What is so special about the first file?
I'm using Visual Studio 2015.
I have installed Knockout typings.
I have empty tsconfig.json file in the solution.
I don't want to reference typings using /// reference comment.
Thanks.

You need to use TSD and install appropriate ".d.ts" file, e.g. for knockout:
tsd install knockout
It downloads "knockout.d.ts" into your project and places definition into typings folder:
typings/knockout/knockout.d.ts
Then you can add corresponding reference to the top or your "ts" file. e.g.:
/// <reference path="../../typings/knockout/knockout.d.ts" />

Related

Exclude folder and all sub folders and files in Visual Studio Web Deployment Project

In Visual Studio 2013, I am trying to exclude an entire folder from the MSI that is created. I tried to adding entries to the ExcludeFilter property of the "Content File from XXX (Active)" item but it doesn't appear to do anything.
I tried the following:
Exclude specific file: \Test\TimerWorker\1\Index.js
Exclude by wildcard: \Test\TimerWorker\1\*.*
Exclude by sub folder: \Test**\*.*
I also tried Googling for a solution and all I could find was about adding tags to the .csproj file but nothing has worked for me yet.
Edit 1:
I tried following the steps outlined in the following article but they made no difference. It looks like all I am able to do from the IDE is exclude files which are located directly under the root folder. Does anyone know how I can exclude an entire folder and all of its subfolders and files?
https://blogs.msdn.microsoft.com/webdev/2010/04/22/web-deployment-excluding-files-and-folders-via-the-web-applications-project-file/
First of all when adding files to installer project, you should add only primary output which will ensure to add only required dependencies.
:
Secondly, if any unwanted file show up in the installer project then you can simply right click and exclude, It will not be copied to destination.

Visual Studio does not find include files, but paths are correct

For my project, I am using Visual Studio 2015. I have added to my include path the folder $(ProjectDir)Source. In details view of Include Directories, in the list below with Evaluated value, the correct path is listed. When I copy this path using #include "path/file", it finds the file. Or via Start > Run, it opens the path.
In my project I have a .cpp file which includes the file like usual:
#include <file>.
Still, I am receiving the error: Cannot open include file 'file.h' No such file or directory. Error C1083.
I copied an existing solution which had similar includes and adjusted them accordingly. It works now.

creating nuget package adds project folder name to payload file path

I'm attempting to create a nuget package using Nuget Package Explorer. The project is just a collection of dlls and files I need copied to the output (bin) directory of the project in which it is used, which unless I'm mistaken is pretty much the way nuget packages work.
However, after creating the package the path to the files I want copied appears to be incorrect, even though I specified no such path in my package.
I created the package, added the libs added the two platforms I want to support (Win8.1 and WP8.1 RT) and added the files for each platform in their respective libs container.
When I install the package into my project it creates the package folder with the exact same structure. Everything looks good.
However, when I then build the project, instead of trying to add the contents of for example:
packages/MyPackage/libs/wpa81/MyProject.WindowsPhone.Data.xml
it's instead attempting to find this:
packages/MyPackage/libs/wpa81/MyProject.WindowsPhone/MyProject.WindowsPhone.Data.xml
and so I get an error like:
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\AppxPackage\Microsoft.AppXPackage.Targets(1496,9):
error APPX0702: Payload file 'C:\Users\Me\Visual
Studio\AnotherProject\packages\MyPackage\lib\wpa81\MyProject.WindowsPhone\MyProject.WindowsPhone.Data.xml'
does not exist.
now, MyProject.WindowsPhone IS the name of the original project I used to create the content I want to include in the package, but I make no reference to this folder anywhere in the nuget package or manifest.
If I manually create that folder and move everything inside it works, but none of the other packages I use require me to do this. I want to simply reference the files that are there, where is it getting this folder name from?
does anyone have any idea what I'm doing wrong? please let me know what information I can add to help identify the problem...

How can I enable typescript compilation

I would like to add typescript files compilation in a VSIX project. I tried to add a typescript file inside the project, add code and save, but ths js file is not created.
thanks,
luca
download and install the typescript plugin
if you modify / rename an existing javascript file you have to set the build action property for that file in the Solution Explorer to TypeScriptCompile.

How to automatically copy files in building project with Visual Studio

I have some custom made XML files and a read me file that I've included in my project.
How do I make it so that these files are copied to my debug/release folders automatically when I build my project? I've tried setting the Copy to Output Directory property to "Copy Always" but this doesn't seem to do the trick.
I'm using VS2010
I've found the answer. The build action needs to be set to Content if you want to just directly copy the file to the output folder.

Resources