Editing Class Libraries in Visual Studio
If you want to take advantage of the speed and Intellisense features in Visual Studio, you can edit class library code there, and add folders and files. These automatically update in Workflow Studio.
There are still some things that you can do only in Workflow Studio:
Add references (these do not update in Workflow Studio when you add them in Visual Studio)
Publish your code
Proprietary designs like workflows and activities
Overview of a Workflow Studio class library
First, let's explore an existing class library. In Workflow Studio, on the Workspace tab, expand WCF Services, which already contains a Class Libraries package.
Now open File Explorer and navigate to a path on your machine containing Workflow Studio class libraries. Notice that it contains the following:
*.cslib files corresponding to the ones in the WCF Services > Class Libraries package
*_Project folders for each of the class libraries represented with a cogwheel icon
Open one of the project (*_Project) folders and notice that it contains:Â
All of the folders under the Classes node in Workflow Studio
All of the C# (*.cs) files under the Classes node
A C# project file (*.csproj)
A Visual Studio solution file (*.sln)
Also note what it does not contain: References.Â
Add a new class library in Workflow Studio
In Workflow Studio, on the Workspace tab, expand WCF Services, right-click Class Libraries, and select Add New Item, then EmpowerID Class Library.
In the Add New Class Library dialog that appears, enter a name for your class library and click OK.
On the Solution tab, in the Code Tree, right-click anywhere and select New Folder.
In the Add New Folder dialog that appears, type Common Code and click OK.
Right-click the new folder and select Add Visual C# Source Item, then Add Class Source.
Â
In the Add New Class dialog that appears, enter a name for the class and click OK. The new class appears in the Common Code folder. (Repeat as necessary, or you can do it in Visual Studio.)
Compile and publish your changes.
In the workspace, close the Class Library, and when prompted, save and check in your changes.
If you have the class library open in both Workflow Studio and Visual Studio, you may inadvertently overwrite your changes. To avoid this, close one before opening the other.
Edit the class in Visual Studio
Open Visual Studio, and in the Source Control Explorer, navigate to your folder.
Double-click the solution file for the project.
A dialog appears, asking whether you want to bind the solution to source control. Click Yes.
In the Change Source Control dialog that appears, select the solution and click the Bind button.
Select the class library on the second line and click Bind again, then click OK.
In Solution Explorer, right-click the project (just under the solution) and select Properties.
In the Properties window that appears, change the Target framework to the latest .NET framework.
A dialog informs you that you must close and reopen the project, and asks whether you are sure you want to change it. Click Yes, and then close and reopen the project.
In Solution Explorer, expand the Common Code folder and click CustomerClass.cs to open it for editing.
Now you can add code, classes, and folders as needed in Visual Studio.
When you are finished coding, from the Build menu, select Rebuild YourClassLibrary to compile the DLL and bring in references.
Publish the class library in Workflow Studio
In Workflow Studio, open your class library from the shortcut on the Startup page. Any changes you made in Visual Studio (except for any references you may have added) appear in Workflow Studio.
In the Code Tree to the right, add any necessary references.
Compile and publish your changes.Â
IN THIS ARTICLE