对于TFS 2010中的构建过程,我创建了一个包含一些自定义代码活动的库。过去,通过将库(*.dll)添加到源代码管理,并将“构建控制器-自定义程序集的版本控制路径”设置到源代码管理中可以找到库的路径,这一切都很好。
但是从几天以来(我经常更新库),构建就不再成功了。报告的错误是:
'{clr-namespace:BuildTasks;assembly=BuildTasks}'“:为生成定义初始化生成时发生错误”无法创建未知类型的TF215097“
在搜索之后,除了将库安装到GAC之外,我找不到任何其他解决方案。这是可行的,但我想知道,为什么不可能使它不安装到GAC。
所以,虽然它现在又起作用了,我想让它回到原来的工作方式,没有GAC。希望你们中有人能帮我。提前谢谢。
发布于 2010-06-02 11:43:44
由于没有给出任何答案,而且我也没有找到任何解决办法,所以我决定现在就把它放进GAC。这也很管用。:)
发布于 2010-07-21 19:39:49
如果要指定包含已编写的自定义代码活动的程序集,则需要执行以下操作:
此时,您有一个自定义XAML工作流,它引用(导入)已包含到源代码管理中的自定义程序集(或多个程序集)。生成控制器现在知道这些自定义程序集的位置。这允许您在需要添加/更新自定义生成任务时“签入”这些自定义程序集的新版本。
希望这能帮到你。我也花了一些时间才弄清楚这件事。如果需要更详细的话请告诉我。我希望我能发布一些对话框的截图。
更新:我完全忘记了这个线程,直到我看到它被恢复了。我还可以更新这个答案,因为我找到了一种非常好的方法,可以让TFS拉出自定义构建任务程序集的最新版本:为程序集创建一个唯一的版本号。
在构建程序集之前,我使用T4模板并运行它。它在读取签入自定义活动DLL后更新AssemblyInfo.cs。
<#@ template debug="false" hostspecific="true" language="C#" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Xml.dll" #>
<#@ import namespace="System.Xml" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Reflection" #>
<#@ output extension=".cs" #>
<#
//relative path to the DLL for your custom assembly in source control
var filename = this.Host.ResolvePath("..\\..\\..\\..\\BuildAssemblies\\BuildTasks.dll");
Version buildInfoAssemblyVersion = AssemblyName.GetAssemblyName(filename).Version;
// Setup the version information. Using the DateTime object make it kinda unique
var version = new Version(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, buildInfoAssemblyVersion.Revision + 1);
#>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows.Markup;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BuildTasks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("BuildTasks")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("feab7e26-0830-4e8f-84c1-774268727cbd")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
// Version information is a combination of DateTime.Now and an incremented revision number coming from the file:
// <#= filename #>
[assembly: AssemblyVersion("<#= version.ToString() #>")]
[assembly: AssemblyFileVersion("<#= version.ToString() #>")]
[assembly: XmlnsDefinition("http://localhost/BuildTasks/Activities", "BuildTasks.Activities")]
[assembly: XmlnsDefinition("http://localhost/BuildTasks/Activities/InstallerA", "BuildTasks.Activities.InstallerA")]
[assembly: XmlnsDefinition("http://localhost/BuildTasks/Activities/InstallerB", "BuildTasks.Activities.InstallerB")]
[assembly: XmlnsDefinition("http://localhost/BuildTasks/Activities/CodeAnalysis", "BuildTasks.Activities.CodeAnalysis")]
[assembly: XmlnsDefinition("http://localhost/BuildTasks/Activities/Standards", "BuildTasks.Activities.Standards")]
[assembly: XmlnsDefinition("http://localhost/BuildTasks/Activities/CI", "BuildTasks.Activities.CI")]
[assembly: XmlnsDefinition("http://localhost/BuildTasks/Activities/Version", "BuildTasks.Activities.Version")]您会注意到,在底部,我还为我在工作流中使用的每个名称空间设置了XML命名空间定义。我发现生成的XMAL看起来要干净得多,它也帮助解决了我的问题。
我以AssemblyInfo.tt的形式创建了这个文件,并确保在构建程序集之前运行它(右键单击并选择run T4或类似的东西)。
发布于 2011-11-11 16:53:22
这个解决方案可能不适用于所有情况,因为以前的帖子中提供的答案是正确的,但不是解决我的问题。这个答案假设如下:
我和(我怀疑其他许多人)正在做的是复制或将他们的xaml工作流文档链接到解决方案中,这样您就可以使用工作流设计器和新的自定义程序集。嗯,这在VS设计器中非常有用,但是VS将用它自己的方式修改您的程序集引用。例如,我有一个如下所示的引用:
xmlns:ca="clr-namespace:Custom.TFS.Activities;assembly=Custom.TFS.Activities" 在使用我的项目解决方案编辑工作流之后,visual studio将其更改为:
xmlns:local="clr-namespace:Custom.TFS.Activities" 当您签入此文件以进行测试或使用时,您现在将看到可怕的TF215097错误。
添加;assembly=your.assembly应该可以解决问题,并消除将所有内容都放在GAC中的需要。您还可能需要修复xaml文件其余部分中使用的名称空间引用。
https://stackoverflow.com/questions/2910983
复制相似问题