Desktop productivity for business analysts and programmers

Custom Tasks for SAS Enterprise Guide - How to use an stored SAS Program in the .NET assembly

Accepted Solution Solved
Reply
Contributor yhz
Contributor
Posts: 21
Accepted Solution

Custom Tasks for SAS Enterprise Guide - How to use an stored SAS Program in the .NET assembly

[ Edited ]

I am using the code in your book, page 190, as below. I also set the Build Action property to: Embedded Resources.

The SAS program is in the BatchRun Solution Explore by Add Existing Item. But in the next line, when I use MessageBox.Show(macro) to check its value, it is blank. Wondering where did I miss something?

 

string macro = SAS.Tasks.Toolkit.Helpers.UtilityFunctions.ReadFileFromAssembly("SAS.Tasks.BatchRun.test.sas");

MessageBox.Show(macro);

 

Thanks!

Yihong


Accepted Solutions
Solution
‎02-03-2016 11:47 AM
Community Manager
Posts: 2,889

Re: Custom Tasks for SAS Enterprise Guide - How to use an stored SAS Program in the .NET assembly

I think that the most likely cause is a mismatched namespace.  In your function call, you reference the "SAS.Tasks.BatchRun" namespace.  But is that really the default namespace for your assembly?

 

Check the Project properties (Application tab) in Visual Studio, and verify that the "Default namespace" is SAS.Tasks.BatchRun.  If it's not, you'll have to change your call to ReadFileFromAssembly to match what is the default namespace.

 

You can also verify the embedded resource full name by running ILDASM on your DLL file, and looking at the manifest.  That will tell you the full namespace referenced.

 

Chris

View solution in original post


All Replies
Solution
‎02-03-2016 11:47 AM
Community Manager
Posts: 2,889

Re: Custom Tasks for SAS Enterprise Guide - How to use an stored SAS Program in the .NET assembly

I think that the most likely cause is a mismatched namespace.  In your function call, you reference the "SAS.Tasks.BatchRun" namespace.  But is that really the default namespace for your assembly?

 

Check the Project properties (Application tab) in Visual Studio, and verify that the "Default namespace" is SAS.Tasks.BatchRun.  If it's not, you'll have to change your call to ReadFileFromAssembly to match what is the default namespace.

 

You can also verify the embedded resource full name by running ILDASM on your DLL file, and looking at the manifest.  That will tell you the full namespace referenced.

 

Chris

Contributor yhz
Contributor
Posts: 21

Re: Custom Tasks for SAS Enterprise Guide - How to use an stored SAS Program in the .NET assembly

Hi Chris,

 

That is exactly what happened! It works now.

Thank you very much for your help!

 

Yihong

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 248 views
  • 1 like
  • 2 in conversation