As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

SAS EG and .NET 2.0

From sasCommunity
Revision as of 17:37, 10 June 2007 by Savian (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Ok, so the official word is no .NET 2.0 apps in EG. I understand this position 100% and I agree with the position. Regardless, .NET 2.0 costs me 25-50% less effort than 1.1 so my goal was to see if I could hack out something that would allow me to post a 2.0 app in EG 4.1.

It is a hack, it's not official, it's limited, etc. but I successfully got my 2.0 app to run under EG and had it post my code to an EG task. Here's how I did it but it is simplistic and not pretty. I share it in case you need something similar.

First, create a 2.0 app. Make it a WinForm and have fun on layout, generics, etc.

Then change parts of your program.cs to something like the following:

MainForm frm = new MainForm();

All Winform apps can write to a console but this output goes to a standard out.

Then change your EG add-in to support it:

public SAS.Shared.AddIns.ShowResult Show(System.Windows.Forms.IWin32Window Owner
   Process proc ;
   proc = new Process() ;
   proc.StartInfo.UseShellExecute = false ;
   proc.StartInfo.RedirectStandardOutput = true ;
   proc.StartInfo.RedirectStandardError = true ;
   proc.StartInfo.CreateNoWindow = true ;
   proc.StartInfo.FileName = "AnalystToolkit.exe";
   proc.Start() ;
   proc.WaitForExit() ;
   sasCode = proc.StandardOutput.ReadToEnd() ;
   return SAS.Shared.AddIns.ShowResult.RunLater;

I could have done a lot more with standard out (and I probably will) but this shows you a quick and easy way to hack up a solution that works. From this standard out, you should be able to make out a way to do anything you need.


Original Article on Savian Blog

--Savian 18:37, 10 June 2007 (EDT)