Problem: Whenever I create a new workflow project and try to compile it, its always failing and unable to compile. The configuration of my system is as follows:
Windows 2008 Server Operating System on my Desktop, Visual Studio 2008 with SP1 Installed. I have also installed windows Azure components on top of Visual Studio.
Though the issue is on Windows 2008 server, I believe similar issue would exist for Windows Vista too. Whenever I try to Compile a windows workflow project in Visual Studio 2008 its failing with following error.
The "CompileWorkflowTask" task failed unexpectedly.
System.NotSupportedException: The given path's format is not supported.
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String[] pathList, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated()
at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile)
at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension)
at System.Workflow.ComponentModel.Compiler.CompileWorkflowTask.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)
I have googled sometime trying to find a fix for the issue, though the issue does exist with Vista, most of the issues have to do with permissions. That didn’t fix my error. Doing some research on the project file by opening it in a notepad has provided me with an Interesting resolution for this problem. The following is the solution that worked for me, and I am still not sure what the root cause of the problem is.
Resolution : Open your project file in notepad find the <Import> section at the end of the file, There will be 2 Import statements typically in the following order
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />
Change the order of the Import settings for the project type to the following order
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
Save and Close the Project file. Reload the project the file, if its already open in your Visual Studio. Now try to compile and run the project. It worked for me. The issue is same for both new projects created on the same machine or existing projects copied on the machine.
Hope this helps.
Note : This is my first blog post from Windows Live Writer. The experience is very user-friendly and I am liking it.
Hey ..it worked perfectly for me ..
ReplyDeletethanks for your help :)
Thanks! worked like a charm!
ReplyDeleteThat is it, solved my problem. You ROCK!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteدمت گرم
ReplyDeleteThanks a lot
ReplyDeletePersian:("دمت گرم")
Thanks, works like a charm. For me the issue was with TeamCity CI build
ReplyDeleteThanks, after days of trying, this finally worked for me!!
ReplyDelete