Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


jrtwynam
2019-07-04T18:08:09Z
Hi,

I'm currently some C#.net code to help with processing something, and I'd like all the methods to be stored in a single class rather than having a smaller class here and there. So it would look something like this:


public class MyClass
{

	public static string Method1(string sParm1)
	{
		//Do stuff
	}
	
	public static string Method2(string sParm2)
	{
		//Do stuff
	}
	
	public static string Method3(string sParm3)
	{
		//Do stuff
	}
	
	public static string Method4(string sParm4)
	{
		//Do stuff
	}

}


The issue I have is that in between calling each of these methods, I need to revert back to VC to do something else, such as query a database in order to get results to pass to the next method. So what I'd end up with is a list of tasks something like this:


  1. Query a database to get some data.
  2. Run Method1 using data from Step 1.
  3. Query a database to get some data that depends on the results of Step 2.
  4. Run Method2 using data from Step 3.
  5. etc, etc


But that ends up having several ".Net Process" tasks, each with identical code and each needing to be compiled, therefore having several identical copies of the executable (dll?) lying around. What I'd like to do is have a single .Net Process task to store the code and compile it, and on subsequent tasks just call a particular method from that task. Is that possible?

Sponsor
Forum information
jrtwynam
2019-07-04T18:15:37Z
I may have just answered my own question. Maybe if I compile the code using a .Net Process task, then dig the weirdly-named DLL file out of the VC directory, I could then point to it with an Assembly Execute task.
thomas
2019-07-05T08:12:32Z
When you say '.Net process task', do you mean the .Net code execute task?

You can achieve what you want:

1) Create a project in Visual Studio, add your code to a class, and compile in release mode.
2) Take the resulting dll (in the bin/release folder), and place it somewhere your VC server can access it
3) Load the dll in an Assembly execute task, and pick the class/method you want to excecute.

Note that if your code references other third party dlls, you have to be more careful about where you place you libraries, to make sure the runtime can find them
Scroll to Top