Error 'TF215097:...Cannot create unknown type for...' custom CodeActivity

Captain picture Captain · Sep 20, 2010 · Viewed 11.2k times · Source

Possible Duplicate:
TFS 2010 Custom Build Activity TF215097 error

I'm trying to create a CustomActivity to run after each successful build.

I've followed the exact steps of several tutorials

  1. http://blogs.blackmarble.co.uk/blogs/rfennell/archive/2010/03/08/lessons-learnt-building-a-custom-activity-to-run-typemock-isolator-in-vs2010-team-build.aspx

  2. http://www.ewaldhofman.nl/post/2010/04/29/Customize-Team-Build-2010-e28093-Part-4-Create-your-own-activity.aspx

  3. http://www.dotnetcurry.com/ShowArticle.aspx?ID=522&AspxAutoDetectCookieSupport=1

And all have lead me to the same result - The build fails after several seconds with this error:

TF215097: An error occurred while initializing a build for build definition 
\MyCompany\Dev - Client: Cannot create unknown type '{clr-
namespace:BuildTasks.Activities;assembly=BuildTasks}TFSBuildLocalizer'.

I came down to a point where I have removed all custom references I had in the CodeActivity project and commented out all of the code.

I have added the output dll to the TFS, and I have the following post build script in the project's properties:

"$(DevEnvDir)\TF.exe" checkout "$/MyCompany/Development/Djenne/Dev/Tools/BuildProcess/Output/$(TargetFileName)"
copy /Y "$(TargetPath)" "C:\tfs2010\MyCompany\Dev\Tools\BuildProcess\Output\$(TargetFileName)"
"$(DevEnvDir)\TF.exe" checkin "$/MyCompany/Development/Djenne/Dev/Tools/BuildProcess/Output/$(TargetFileName)"

I've made sure that the namespace in the workflow xaml is correct for the custom CodeActivity.

I have no idea what else can I try,

Please help!

Thanks,

EDIT: I'm adding more descriptions about what I've already tried:

The CodeActivity class already have the attribute:

[BuildActivity(HostEnvironmentOption.All)]

The CodeActivity class is contained inside an Activity Library project. Here is the ProjectTypeGuids tag inside the csproj file:

<ProjectTypeGuids>{32f31d43-81cc-4c15-9de6-3fc5453562b6};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

In the custom workflow xaml I've added my CodeActivity right after "Get Impacted Tests, Index Sources and Publish Symbols"

I currently don'e have any InArgument nor OutArgument in my CodeActivity.

These are the references in my CodeActivity project:

  • Microsoft.CSharp
  • Microsoft.TeamFoundation.Build.Client
  • System
  • System.Activities
  • System.Core
  • System.Data
  • System.Data.DataSetExtensions
  • System.Xaml
  • System.Xml
  • System.Xml.Linq
  • WindowsBase

In "Build Controller Properties" I have set the "Version control path to custom assemblies" with the same TFS path as my post build script: $/MyCompany/Development/Djenne/DEV/Tools/BuildProcess/Output

In my Build Definition I've set "Build process template" with my custom workflow xaml.

Thank you guys for the answers, do you have any more thoughts? Thanks

Answer

Captain picture Captain · Sep 26, 2010

Ok, I got this thing figured out.

Here's what worked for me:

I've installed my dll to the GAC in the build server, ran the build and suddenly it worked!

gacutil.exe /i buildtasks

Afterwards, I've uninstalled the dll from the GAC, and it keeps working even still.

gacutil.exe /u buildtasks

Another thing, my project had several references which I also had to checkin in the same directory as the CodeActivity dll itself. So to do that I've changed my project's post build script:

cd "C:\tfs2010\Djenne\Dev\Tools\BuildProcess\Output\"
"$(DevEnvDir)\TF.exe" checkout "$/TradeNetworks/Development/Djenne/Dev/Tools/BuildProcess/Output/*.*"
xcopy "$(TargetDir)*.*" "C:\tfs2010\Djenne\Dev\Tools\BuildProcess\Output\" /E /R /C /Y

The only thing left to do now is to figure out how to debug this damn thing. But that's an issue for another question.

Thanks to everybody who helped,

Hope this will help anyone in the future as well.

EDIT:

One more thing I've noticed is every time I edit my custom workflow, it regenerates the xaml and removes the ";assembly=BuildTasks" suffix from the custom CodeActivity namespace (xmlns). So after every change I need to edit the xaml to fix it over and over again, otherwise the same error reoccurres.