BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
yhz
Fluorite | Level 6 yhz
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
yhz
Fluorite | Level 6 yhz
Fluorite | Level 6

Hi Chris,

 

That is exactly what happened! It works now.

Thank you very much for your help!

 

Yihong

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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