index > Windows Workflow Foundation > How to get WPF and WF work together?

How to get WPF and WF work together?

Hi,

I got this two technologies to work together but only to a certain degree.

As soon as I want to describe wpf components derived from my own type I'm having problems with namespace mapping. I'm getting following error messages:

- If this type is from another assembly:
"Unknown build error, ''clr-namespace:MyNamespace;Assembly=MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' mapping URI is not valid. Line 2 Position 13."

- If this type is from the same assembly:
"The "CompileWorkflowTask" task failed unexpectedly.
System.ArgumentException: The resource string "UnsupportedProjectType" for the "CompileWorkflowTask" task cannot be found. Confirm that the resource name "UnsupportedProjectType" is correctly spelled, and the resource exists in the task's assembly.
at Microsoft.Build.Shared.ErrorUtilities.ThrowArgument(Exception innerException, String resourceName, Object[] args)
at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowArgument(Boolean condition, Exception innerException, String resourceName, Object arg0, Object arg1)
at Microsoft.Build.Utilities.TaskLoggingHelper.FormatResourceString(String resourceName, Object[] args)
at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorFromResources(String subcategoryResourceName, String errorCode, String helpKeyword, String file, Int32 lineNumber, Int32 columnNumber, Int32 endLineNumber, Int32 endColumnNumber, String messageResourceName, Object[] messageArgs)
at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorFromResources(String messageResourceName, Object[] messageArgs)
at System.Workflow.ComponentModel.Compiler.CompileWorkflowTask.ValidateParameters()
at System.Workflow.ComponentModel.Compiler.CompileWorkflowTask.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)"

My mapping looks like this:
<ns0:MyWindow1 x:Class="WorkflowProject1.MyWindow2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ns0="clr-namespace:WorkflowProject1"
>
</ns0:MyWindow1>
And if type is from another assembly the mapping line was:
xmlns:ns0="clr-namespace:ClassLibrary1;Assembly=ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

I saw in many samples the namespace mapping working. But all this samples were either WPF or WF only projects.

My way of combining WPF and WF was:
- create workflow project
- add my wpf window classes
- to make it compile (it didn't recognized InitializeComponent method etc.) I added into the project file this line: <Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" /> so I had three imports in total:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets" />
<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />

Can anybody tell me how I can get it working?

Thanks!

[Update]
BTW I'm using RC1 right now and tried it before also with Beta 2.2 (didn't got it to work either)
pkonrad
Is it a requirement that the workflow and the wpf components have to be in a single project, my hunch is that it has to do with the edits to the import section? Does this work if you have a workflow project and reference it from the wpf project? This has been how I have done things in the past, I haven't tried to put them both in the same project.


Technical Evangelist -- Windows Workflow Foundation
Matt Winkler -- MSFT
Thank you for the hint, I'll try it out.
Philipp Konradi
reply 3

You can use google to search for other answers

 

More Articles

• Timers in a Workflow hosted in ASP.Net
• User accessing a ASP.NET Application
• Pattern for updating custom Activity Properties without completin...
• How to get workflow instance from database?
• Problem passing parameters from workflow to custom activity using...
• Missing Parameters Property on Sequential Workflow
• Problem with Tutorial - Creating a Sequential Workflow
• Using rules without WF
• After wf receives external event, the host never sees any more tr...
• Replicator and correlation
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Rules Editor Not Loading With Beta 2.2 (
• Licensing Costs
• TypeProvider and persistence
• custom SequenceActivity - howto execute
• Changing Order of Rules With The Ruleset
• Hide "Bind to new member" tab
• Want the webforms alternative for the wi
• How to get an ActivityExecutionContext i
• Transactions - ensuring consistency betw
• errors encountered while loading the des
• Using Workflows for documentation purposes
• Using ManualWorkflowSchedulerService
• Co-ordinating workflows with external ev
• Tasklist
• Mail to James Conrad

Hot Articles

• regarding passing parameters between wor
• Using data objects from database for hol
• Using Dynamic rules in workflow
• Is there a notification service Activity
• Binding array parameters to webServiceOu
• WWF-SqlWorkflowPersistenceService
• WF version packaged with WinFX Beta 2
• Window workflow Parameters
• Root Namespace for VB Project
• How to get the value of the Property in
• Bind parameters to dependant properties?
• Ownership supposed to be released during
• Exceptions While Creating the View
• Retrieve the property value of an activi
• Bug? generic Dictionary as Property

Recommend Articles

• Why WF?
• Designers built to access fields only?
• Workflow Activities for MSBuild Tasks an
• Why I can not combind the SqlTracking &a
• How one can create workflow project?
• WorkflowLoadingFailed in asp.net
• A question about custom activity's prope
• Using a Create Task Activity inside a Wh
• Correlation between two diferent workflows
• Hosting designer on an asp.net application
• SqlBulkCopy?
• Sample location needed
• Correlation with nested custom activities
• WorkflowWebRequestContext in Beta 2.2
• Beta 2.2 - accessing current workflowRun