C# Compiler optimization – Unused methods

Just checked in reflector with a release build. The compiler doesn’t remove the unused private methods. There are ways to use a method without the compiler knowledge, like with reflection. So the compiler doesn’t try to guess. It just leaves the methods there. The only private methods the compiler removes are partial methods without implementation. … Read more

How to increase error limit in Visual Studio?

This limitation is hardcoded. Here is the post from the MSFT employee in the microsoft.public.vsnet.general group dated 2006 (look for ‘Fatal Error C1003’): Hi, Unfortunately this 100 limitation is hard coded and cannot be changed. It’s just inpractical to keep all errors information around since one error may cause other several errors. I hope you … Read more

Post Publish Events

Update: Since Publish Web does not apply to folder-based web site projects, this answer assumes you are asking about a Web Application project. You can’t do this from inside the VS IDE. However, you can edit your project file in Notepad or your favorite XML editor and add a new target at the end of … Read more

Replicate VS2008 “Publish Web Site” from command line

The following command duplicates the Publish Web Site dialog with default settings. Command for Publish Web Site with Default Settings aspnet_compiler -nologo -v / -p “C:\WebSite1” -u “C:\TargetPath” Reference 1) See Community Content titled You want Publish a site but you have not Visual Studio then… at http://msdn.microsoft.com/en-us/library/20yh9f1b(classic).aspx. Microsoft Visual Studio 2005 > Visual Studio … Read more

Static Linking of libraries created on C# .NET

ILMerge is what you’re after. I’m not sure I’d really call this “static linking” – it’s just merging several assemblies into one. (In particular, please don’t get the impression that this is building a native, unmanaged executable.) However, I think it’s what you’re after 🙂 Update: ILMerge is now open source and is also available … Read more