Windows CRT and assert reporting (abort, retry, ignore)

This works (for me atleast, on vs 2008): (Essentially, return TRUE from the hooked function) int __cdecl CrtDbgHook(int nReportType, char* szMsg, int* pnRet) { return TRUE;//Return true – Abort,Retry,Ignore dialog will *not* be displayed return FALSE;//Return false – Abort,Retry,Ignore dialog *will be displayed* } int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { _CrtSetReportHook2(_CRT_RPTHOOK_INSTALL, CrtDbgHook); assert(false); … Read more

Visual Studio macro: Find files that aren’t included in the project?

Here is the C# version of your code: public static void IncludeNewFiles() { int count = 0; EnvDTE80.DTE2 dte2; List<string> newfiles; dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject(“VisualStudio.DTE.10.0”); foreach (Project project in dte2.Solution.Projects) { if (project.UniqueName.EndsWith(“.csproj”)) { newfiles = GetFilesNotInProject(project); foreach (var file in newfiles) project.ProjectItems.AddFromFile(file); count += newfiles.Count; } } dte2.StatusBar.Text = String.Format(“{0} new file{1} included in the … Read more

How can I invoke my MSBuild Target when msbuild.exe starts and when it ends

To execute a solution-wide Before and After targets, you would create two MSBuild project files named “after.<SolutionName>.sln.targets” and “before.<SolutionName>.sln.targets” in the same folder as your solution. To do this on all solutions, you would drop your custom solution-level after targets files into the path $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\SolutionFile\ImportBefore\ or $(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\SolutionFile\ImportAfter. When those solutions are built, it will import … Read more