How to fix “Internal Diagnostics Hub Exception” in VS 2015 Update 1?

I dug into the the Visual Studio logs to understand what was happening (C:\Users\YourUser\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml). In mine, the messages were something like this: <entry> <record>846</record> <time>2016/07/22 01:07:20.351</time> <type>Information</type> <source>VisualStudio</source> <description>Entering function CVsPackageInfo::HrInstantiatePackage</description> <guid>{2FFE45C4-5C73-493C-B187-F2E955FF875E}</guid> </entry> <entry> <record>847</record> <time>2016/07/22 01:07:20.367</time> <type>Information</type> <source>VisualStudio</source> <description>Begin package load [Microsoft.VisualStudio.LanguageServices.TypeScript.TypeScriptPackage, Microsoft.VisualStudio.LanguageServices.TypeScript, Version=14.0.0.0, Culture=neutral]</description> <guid>{2FFE45C4-5C73-493C-B187-F2E955FF875E}</guid> </entry> <entry> <record>848</record> <time>2016/07/22 01:07:20.374</time> <type>Error</type> <source>VisualStudio</source> <description>LegacySitePackage … Read more

“Are you missing an assembly reference?” compile error – Visual Studio

In my case it was a project defined using Target Framework: “.NET Framework 4.0 Client Profile ” that tried to reference dll projects defined using Target Framework: “.NET Framework 4.0”. Once I changed the project settings to use Target Framework: “.NET Framework 4.0” everything was built nicely. Right Click the project->Properties->Application->Target Framework

After Publish event in Visual Studio

UPDATE: seems like in VS 2019 and .NET 5 you can now use Publish target. <Target Name=”Test” AfterTargets=”Publish”> <Exec Command=”blablabla” /> </Target> Here’s my old answer that also works: MS has confirmed, that when publishing to file system they don’t have any target to launch after that. “We currently do not support executing custom targets … Read more

Visual Studio – how to find source of heap corruption errors

Begin with installing windbg: http://www.microsoft.com/whdc/Devtools/Debugging/default.mspx Then turn on the pageheap like this: gflags.exe /p /enable yourexecutable.exe /full This will insert a non writable page after each heap allocation. After this launch the executable from inside windbg, any writes outside the heap will now be caught by this debugger. To turn of the pageheap afterwards use … Read more

How to programmatically include a file in my project?

It worked for my just adding the it to the ProjectFolder, and also add the folder programmatically like this. var p = new Microsoft.Build.Evaluation.Project(@”C:\projects\BabDb\test\test.csproj”); p.AddItem(“Folder”, @”C:\projects\BabDb\test\test2″); p.AddItem(“Compile”, @”C:\projects\BabDb\test\test2\Class1.cs”); p.Save();