Do not compile t4 file - visual-studio

Suddenly, after doing a TFS 2010 get, Visual Studio 2010 is attempting to compile my .tt file as if it was c#.
Moreover, anytime I set it to "Build Action=None", Build Action gets mysteriously reset to Compile. This is breaking our builds on the desktop. I can get builds to work on the desktop by closing then reopening VS.
Our builds on TFS are totally broken because of this. What to do?
The template generates a (totally ok) c# file, so I need the project to build.
I tried changing the file extension from .tt to .donotbuilddammit but that had no effect.

Are you by chance using the Clairus T4 plugin (or another T4 intellisense provider)?
If so, try making sure the files are not open when you change the BuildAction setting.
Visual Studio builds intellisense
based on the compile action of your
files. It will only provide
intellisense for files that are marked
as "compile". Because of that, we
change the build action when the file
is open, and we change it back to
whatever it was before when checking
in, closing the file, closing Visual
Studio and also when opening Visual
Studio (in case it crashed)
See: http://forums.clariusconsulting.net/viewtopic.php?f=12&t=445

Related

prevening visual stuidio project has change dialog

I have written a MsBuild task that may change the project file it is within. All works fine however I get do get the project has changed dialog when I build the project in visual studio.
Can any one help me with how (within a Visual Studio extension on a BuildEvent I assume) to prevent this from happening.

Use cmake to generate Visual Studio sln project without link to original CMakeFiles.txt

I need to use cmake to generate visual studio sln file, BUT I want to ensure, that this generated *.sln file will not be connected with original CMakeFiles.txt (I want to generate sln file once).
I know that this is not typical usage and the connection with source CMakeFiles.txt is in standard usage perfect, but in my case it is not wanted -- I want to distribute these sln files (solution with projects) to some colleagues, who do not have CMake.
Maybe there is another approach (except cmake), to create few visual studio project without annoying clicking in Visual Studio.
Thanks,
Radek
I need to use cmake to generate visual studio sln file, BUT I want to
ensure, that this generated *.sln file will not be connected with
original CMakeFiles.txt
By design CMake will generate solution files that depend on CMake so this part is not really possible with CMake alone.
Maybe there is another approach (except cmake), to create few visual
studio project without annoying clicking in Visual Studio.
There is a way to stop regeneration in the IDE. I use this in many of my projects most likely for the same reason you do. At least with older versions of Visual Studio the regeneration caused dozens of prompts. Although I believe Visual Studio 2013 only prompts 1 time now I still enable this. The following code (inserted near the top of my root CMakelists.txt) is what I use to enable the option to suppress IDE regeneration.
option (CMAKE_SUPPRESS_REGENERATION "Suppress the cmake macro that causes regeneration of build scripts during build" ON)

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.

How can I have TypeScript build only on save in Visual Studio

When I build the project, it is redundantly building script event though I have script compiling on run/debug. Is there a way to make it only build on save?
If you have installed Web Essentials 2012 extension it is very easy.
In Visual Studio go to Tools -> Options -> Select Web Essentials, Under the TypeScript set "Compile TypeScript on Save" to True
You can set the build type to none and saving the .ts file will still build the .js file. However, the .js file does not get checked in to TFS so when someone gets the project, they would have to open and save every file. This seems to be another issue.

Visual studio 2010 rebuilds with no modifications?

I found something strange when i was building a project, after I built my project, I can get the latest output file (.exe) and then I tried building the project again.
As far as I know, at this time visual studio won't make a new output file again, but it made a newer file again even though I didn't modify any source codes.
Why is this happening?
as i know, at this time visual studio must not make a new output file again.
Visual Studio rebuilds the file even if there are no code changes.
Visual Studio does not recompile if there no changes, but always generates (build) a new executable.

Resources