Category Archives: VS 2015

Why folders keep reappearing in my Visual Studio 2015 (WebForms) project?

tl;dr

If you have in your project files you moved to different location or removed but your .csproj still points to lets say : removedFolder/removedSubfolder/removedFile.ts then it might happen VS will recreate folders where you point (in this case  removedFolder/removedSubfolder).
What triggers this I wasn’t able to isolate and verify reliably (VS builds? open solution? some timer?).

My VS 2015 version to compare with yours :

Microsoft Visual Studio Enterprise 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.6.01586

I have quite some plugins installed, so maybe some plugin is causing this. I can dump list of all my plugins, if needed. Just mail me.

my setup and how I found out

This happened to me on project  I work on and was quite difficult one to troubleshoot. Project is a bigger WebForms solution with some TypeScript files (among other stuff). We reordered some folders and forgot to save changes to .csproj. Since files we moved are TypeScript files and switched from built in TypeScript tooling build to npm builds, no build time error occurred. Folders kept reappearing and it was difficult to find some pattern what caused it. npm TypeScript builds? Running tape + karma tests? Some other tools? SVN even? No clue. But after I excluded missing files, folders didn’t appeared anymore. So I made a test solution like this,

VS with missing files

and boom, folders re appeared 🙂

Hope this helps.

How to disable building of TypeScript files in Visual Studio 2015

If you would like to disable building TypeScript files in your solution for some reason (you want different build workflow, you just work on .cs files and don’t touch .ts files), you had to search for some kind of ifs or comments out to the project file in previous version of Visual Studio.

The problem as such is not new and solution was requested for some time from TypeScript team.

After digging in some articles I found this not much hyped solution :
add node

<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>

to the first

<PropertyGroup>

element in .csproj file.

For me, it worked.

More on the problem here :
https://github.com/Microsoft/TypeScript/issues/2326
https://github.com/Microsoft/TypeScript/issues/2294

One small note : if you have an error in the .ts files and compilation is disabled, build will not fail in Visual Studio 2015. But you can still see all errors in Error list tab. And you will still have IntelliSense.