2009-09-21 47 views
2

我从继承自UserControl的ViewBase类继承项目中的所有视图。在我的XAML中,我参考它:Silverlight ViewBase在单独的程序集中 - 可能吗?

<f:ViewBase x:Class="Forte.UI.Modules.Configure.Views.AddNewEmployeeView" 
    xmlns:f="clr-namespace:Forte.UI.Modules.Configure.Views" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 

它工作正常。

现在我已经搬到了ViewBase到另一个项目(这样我就可以从多个项目refernce它),所以我引用它想:

<f:ViewBase x:Class="Forte.UI.Modules.Configure.Views.AddNewEmployeeView" 
    xmlns:f="clr-namespace:Forte.UI.Modules.Common.Views;assembly=Forte.UI.Modules.Common" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 

当我从IDE中运行,但是当我运行这工作得很好从相同的MSBuild SLN它给出了一个警告:

“H:\ dev的\ ExternalCopy \代码\ UI \模块\配置\ Forte.UI.Modules.Configure.csproj”(默认目标) (10:12 ) - > (ValidateXaml target) - > H:\ dev \ ExternalCopy \ Code \ UI \ M odules \ Configure \ Views \ AddNewEmployee \ AddNewEmployeeView.xaml(1,2,1,2):警告:标记'ViewBase'不存在于XML命名空间'clr-namespace:Forte.UI.Modules.Common.Views; assembly = Forte.UI.Modules.Common”。

然后失败:

“H:\ dev的\ ExternalCopy \代码\ UI \模块\配置\ Forte.UI.Modules.Configure.csproj”(缺省目标) (10: 12) - > (ValidateXaml target) - > C:\ Program Files \ MSBuild \ Microsoft \ Silverlight \ v3.0 \ Microsoft.Silverlight.Common.targets(210,9): 错误MSB4018:“ValidateXaml”任务意外失败。\ r C:\ Program Files \ MSBuild \ Microsoft \ Silverlight \ v3.0 \ Microsoft.Silverlight.Common.targets(210,9):er ror MSB4018:System.NullReferenceEx ception:对象引用未设置为对象的实例。\ r C:\ Program Files \ MSBuild \ Microsoft \ Silverlight \ v3.0 \ Microsoft.Silverlight.Common.targets(210,9):er ror MSB4018:在MS.MarkupCompiler.ValidationPass.ValidateXaml(String fileName,Assembly [] assemblies lies,Assembly callingAssembly,TaskLoggingHelper log,Boolean shouldThrow)\ r C:\ Program Files \ MSBuild \ Microsoft \ Silverlight \ v3.0 \ Microsoft.Silverlight .Common.targets(210,9):er ror MSB4018:at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute()\ r C:\ Program Files \ MSBuild \ Microsoft \ Silverlight \ v3.0 \ Microsoft.Silverlight.Common.targets(210,9):er ror MSB4018:at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute()\ r C:\ Program Files \ MSBuild \ M icrosoft \ Silverlight \ v3.0 \ Microsoft.Silverlight.Common.targets(210,9):er ror MSB4018:at Microsoft.Silverlight.Build.Tasks.ValidateXaml.Execute()\ r C:\ Program Files \ MSBuild \ Microsoft \ Silverlight \ v3.0 \ Microsoft.Silverlight.Common.targets(210,9):er ror MSB4018:在Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy引擎 eProxy,ItemBucket存储桶,TaskExecutionMode howToExecuteTask,ITask任务,布尔& taskResult)

任何想法可能会导致此行为?

使用Silverlight 3

下面是一个砍下构建失败,在IDE建立精细的SLN(抱歉,不能让它在这里格式)的MSBuild文件的版本:

< ?xml version =“1.0”encoding =“utf-8”? > <项目的xmlns = “http://schemas.microsoft.com/developer/msbuild/2003” DefaultTargets = “编译” > <的ItemGroup > < ProjectToBuild包括= “.. \ UI \ Forte.UI.sln” > <属性>配置=调试< /属性> </ProjectToBuild > < /的ItemGroup > <目标名称= “编译” > <的MSBuild项目= “@(ProjectToBuild)” > </MSBuild的> < /目标> < /项目>

感谢您的帮助!

回答

0

到目前为止,我发现解决这个问题的唯一方法是参考实际装配而不是项目。这有点狡猾,任何人有更好的主意?

相关问题