Difference between revisions of ".NET"

From Blue-IT.org Wiki

(Programming MS Office in C# - Why?)
(CSharp)
Line 35: Line 35:
  
 
== CSharp ==
 
== CSharp ==
=== Shellscripts ===
+
=== Shellscripts in Windows ===
  
 
Compiling an application
 
Compiling an application
Line 72: Line 72:
 
 
 
 
 
  }
 
  }
 +
 +
=== Shellscripts in Mono ===
 +
 +
* http://www.csscript.net/help/CS-Script_on_Mono.html
  
 
[[Category:.NET]]
 
[[Category:.NET]]
 
[[Category:CSharp]]
 
[[Category:CSharp]]
 
[[Category:Office 2010]]
 
[[Category:Office 2010]]

Revision as of 21:31, 10 July 2014

Programming MS Office in C# - Why?

There are a lot of complaints on not developing open source software on csharp (Stallman - Don't depend on mono). There might be or might be not an software patent issue with C# in future.

Unfortunately it is obvious, that a lot of software has to be developed for Microsoft Office out there. As a programmer addicted to document management, I can't ignore that. So I was looking around searching to get my work done without beeing bundled with Visual Studio ...

As long as Microsoft products are tight to C# in this way it is wise to use this programming language in a pragmatic manner.

C# sharp has a lot of interesting features. And the code base is open!

Monodevelop

--Apos (talk) 22:58, 10 July 2014 (CEST) The inizan-yannick-ppa in this list seems to be one of the stable ones (to be tested)

sudo apt-add-repository ppa:inizan-yannick/mono
sudo apt-get update
sudo apt-get install monodevelop mono

NetOffice

The Manufactor describes the advantages of developing for MS Office with its product in the following way:

Why NetOffice?

The usual methods for accessing Microsoft Office. NET are the Primary Interop Assemblies and VSTO. Both access methods involve various disadvantages.

They are limited to a version, i.e. they only work with one or certain versions of Office They cause problems while transferring or installation on other systems They offer no protection mechanism in the management of COM proxies

NetOffice eliminates these disadvantages and remains a 1:1 wrapper that is syntactically and semantically identical to the interop assemblies.

CSharp

Shellscripts in Windows

Compiling an application

c:\Windows\Microsoft.NET\Framework\v3.5\csc.ext /t:exe /out:my.exe my.cs


Simple application example

using System;
using System.Diagnostics;
using System.ComponentModel;

public class Script
{
	/// Add a shared network drive mapping
	/// </summary>
	/// <param name="uri">The drive letter (e.g. L:)</param>
	/// <param name="unc">The UNC path to the remote drive (e.g. \\MyServer\MyPrinter)</param>
	/// <param name="opt">Mount options (e.g. /persistent:yes /credsave)</param>
	static void MapNetworkDrive(string uri, string unc, string opt)
	{
		ProcessStartInfo pInfo = new ProcessStartInfo("net", "use " + uri + " " + unc + " " + opt);
		pInfo.CreateNoWindow = false;
		pInfo.UseShellExecute = true;
		pInfo.WindowStyle = ProcessWindowStyle.Hidden;
		Process RunIt = Process.Start(pInfo);
		RunIt.WaitForExit(5000); //give it some time to finish
		RunIt.Close();
 
	}
 	
	static void Main()
	{
		MapNetworkDrive("Z:", "\\servername\share", "/savecred");
	}
				
}

Shellscripts in Mono