How to uniquely identify computer using C#?

Write a function that takes a few unique hardware parameters as input and generates a hash out of them. For example, Windows activation looks at the following hardware characteristics: Display Adapter SCSI Adapter IDE Adapter (effectively the motherboard) Network Adapter (NIC) and its MAC Address RAM Amount Range (i.e., 0-64mb, 64-128mb, etc.) Processor Type Processor … Read more

How to get all sections by name in the sectionGroup applicationSettings in .Net 2.0

Take a look at the ConfigurationManager.OpenExeConfiguration function to load in your configuration file. Then on the System.Configuration.Configuration class that you’ll get back from ConfigurationManager.OpenExeConfiguration you’ll want to look at the SectionGroups property. That’ll return a ConfigurationSectionGroupCollection in which you’ll find the applicationSettings section. In the ConfigurationSectionGroupCollection there will be a Sections property which contains the … Read more

Differences in development between .NET and Mono

What does Mono not provide that Visual Studio does? MonoDevelop is presumably what you mean here. MonoDevelop offers cross platform development on Linux, Mac OS X, Windows based on GTK. However it is not as polished as Visual Studio for obvious reasons – it’s 3 people making it, not hundreds. It has some nice features, … Read more

How to use Process.Start() or equivalent with Mono on a Mac and pass in arguments

To make Process.Start use exec directly instead of using the OS’ mechanism for opening files, you must set UseShellExecute to false. This is also true on Linux and Windows. Process.Start(new ProcessStartInfo ( “/Applications/Google Chrome.app/Contents/MacOS/Google Chrome”, “–no-first-run”) { UseShellExecute = false }); Note that you can also use ‘open’ for your use case, to run the … Read more

Does the Razor View Engine work for Mono?

Yes, it does. I have it working with mono on Linux. You need mono 2.10.2+ from the stable sources from http://ftp.novell.com/pub/mono/sources-stable/ http://download.mono-project.com/sources/mono/ Then, you need to localcopy these assemblies into your app’s bin directory (you take them from Visual Studio on Windows): System.Web.Mvc.dll System.Web.Razor.dll System.Web.WebPages.dll System.Web.WebPages.Deployment.dll System.Web.WebPages.Razor.dll Then, you might have to get rid of … Read more

NuGet on Linux: Error getting response stream

I was able to get this working by importing the certificates into the machine store and not the user store, which is the default: $ sudo mozroots –import –machine –sync $ sudo certmgr -ssl -m https://go.microsoft.com $ sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net $ sudo certmgr -ssl -m https://nuget.org I verified that before I did this … Read more

Mono Compiler as a Service (MCS)

Ok, I think I have some answers. To resolve the assembly load problem, I can either place a call to Assembly.LoadWithPartialName inside Mono.CSharp.Driver.LoadAssembly, or do the following in my application AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); private static bool isResolving; static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { if (!isResolving) { isResolving = true; var a = Assembly.LoadWithPartialName(args.Name); … Read more