2009-09-21 44 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

到目前爲止,我發現解決這個問題的唯一方法是參考實際裝配而不是項目。這有點狡猾,任何人有更好的主意?

相關問題