Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to use Microsoft.interop.excel.workbook type sequence variable in workflow foundation, when I try to use the workbook type, it throws the exception as:Expression Activity type 'CSharpValue`1' requires compilation in order to run. Please ensure that the workflow has been compiled.

What I have tried:

i have added Microsoft.Office.Interop.Excel.dll in workflow foundation activity library, and created a simple activity which takes Microsoft.Office.Interop.Excel.Workbook as InArgument and tried to test this activity throgh a WorkflowConsoleApplication but it throws the exception as Activity type 'CSharpValue`1' requires compilation in order to run. Please ensure that the workflow has been compiled.

This is my XAML code:

XML
<activity mc:ignorable="sap sap2010 sads" x:class="InteropConsoleApplication.TestAct" sap2010:expressionactivityeditor.expressionactivityeditor="C#" sap2010:workflowviewstate.idref="InteropConsoleApplication.TestAct_1" 
="" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:i="clr-namespace:InteropActivityLibrary;assembly=InteropActivityLibrary" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mca="clr-namespace:Microsoft.CSharp.Activities;assembly=System.Activities" xmlns:moie="clr-namespace:Microsoft.Office.Interop.Excel;assembly=Microsoft.Office.Interop.Excel" xmlns:moie1="clr-namespace:Microsoft.Office.Interop.Excel;assembly=InteropActivityLibrary" xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <textexpression.namespacesforimplementation>
    <sco:collection x:typearguments="x:String">
      <x:string>System
      <x:string>System.Collections.Generic
      <x:string>System.Data
      <x:string>System.Linq
      <x:string>System.Text
      <x:string>Microsoft.Office.Interop.Excel
    
  
  <textexpression.referencesforimplementation>
    <sco:collection x:typearguments="AssemblyReference">
      <assemblyreference>InteropActivityLibrary
      <assemblyreference>Microsoft.CSharp
      <assemblyreference>Microsoft.Office.Interop.Excel
      <assemblyreference>System
      <assemblyreference>System.Activities
      <assemblyreference>System.Core
      <assemblyreference>System.Data
      <assemblyreference>System.Runtime.Serialization
      <assemblyreference>System.ServiceModel
      <assemblyreference>System.ServiceModel.Activities
      <assemblyreference>System.Xaml
      <assemblyreference>System.Xml
      <assemblyreference>System.Xml.Linq
      <assemblyreference>mscorlib
      <assemblyreference>InteropConsoleApplication
    
  
  <sequence sap2010:workflowviewstate.idref="Sequence_1">
    <sequence.variables>
      <variable x:typearguments="moie1:Workbooks" name="variable1">
    
    <i:testactivity text="{x:Null}" sap2010:workflowviewstate.idref="TestActivity_1">
      <i:testactivity.text1>
        <inargument x:typearguments="moie1:Workbooks">
          <mca:csharpvalue x:typearguments="moie1:Workbooks">variable1
        
      
    
    <sads:debugsymbol.symbol>d2FDOlxVc2Vyc1xwaXRjaGFpeWFuXHNvdXJjZVxyZXBvc1xJbnRlcm9wQ29uc29sZUFwcGxpY2F0aW9uXEludGVyb3BDb25zb2xlQXBwbGljYXRpb25cVGVzdEFjdC54YW1sAysDNw4CAQEvBTUWAgECMgsyWQIBAw==
  
  <sap2010:workflowviewstate.viewstatemanager>
    <sap2010:viewstatemanager>
      <sap2010:viewstatedata id="TestActivity_1" sap:virtualizedcontainerservice.hintsize="200,22">
      <sap2010:viewstatedata id="Sequence_1" sap:virtualizedcontainerservice.hintsize="222,146">
        <sap:workflowviewstateservice.viewstate>
          <scg:dictionary x:typearguments="x:String, x:Object">
            <x:boolean x:key="IsExpanded">True
          
        
      
      <sap2010:viewstatedata id="InteropConsoleApplication.TestAct_1" sap:virtualizedcontainerservice.hintsize="262,226">
Posted
Updated 13-Mar-19 0:21am
v2
Comments
Richard MacCutchan 13-Mar-19 4:32am    
"Please ensure that the workflow has been compiled."
What part of this message is unclear?
Member 12766428 13-Mar-19 5:04am    
Hi Richard , thanks for the comment , when i use the type string in InArgument there is no exception but when i try to use Microsoft.Interop.Excel.Workbook as type for InArgument the above exception is thrown from WorkflowInvoker.Invoke() method.
Maciej Los 13-Mar-19 5:21am    
Share your code.
Member 12766428 13-Mar-19 5:43am    
Hi Maciej Los,

Thanks for your time, this is my XAML code having the activity named as TestActivity with two parameters Text of type string and Text1 of type Microsoft.Interop.Excel.Workbooks.

[EDIT]Xaml code has been moved into a question[/EDIT]
[no name] 13-Mar-19 10:42am    
Keep reading Richard's comment. It's not some vague clue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900