2015-06-05 67 views
2

我想用FSXaml在F#中創建一個gui。編譯時出現以下錯誤。我也從FsXaml獲得了同樣的示例演示程序錯誤。提前感謝您的幫助。FsXaml加載錯誤

我得到的錯誤是:

FSC: error FS3031: The type provider 'C:\Dev\ATF\tp\FsXaml\Debug\FsXaml.Wpf.TypeProvider.dll' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FsXaml.Wpf.TypeProvider' which cannot be loaded or doesn't exist. Could not load file or assembly 'file:///C:\Dev\ATF\tp\FsXaml\Debug\FsXaml.Wpf.TypeProvider.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

完整的錯誤是在這裏:

------ Build started: Project: atfgui, Configuration: Debug Any CPU ------ C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0\fsc.exe -o:obj\Debug\atfgui.exe -g --debug:full --noframework --define:DEBUG --define:TRACE --doc:bin\Debug\atfgui.XML --optimize- --tailcalls- --platform:x64 -r:C:\Dev\ATF\assembly\Debug\frameworkevents.dll -r:C:\Dev\ATF\tp\FsXaml\Debug\FsXaml.Wpf.dll -r:C:\Dev\ATF\tp\FsXaml\Debug\FsXaml.Wpf.TypeProvider.dll -r:C:\Dev\ATF\assembly\Debug\hostengine.dll -r:C:\Dev\ATF\assembly\Debug\mktdataservices.dll -r:C:\Dev\ATF\assembly\Debug\mktdatastructs.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\mscorlib.dll" -r:C:\Dev\ATF\assembly\Debug\persistence.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\PresentationCore.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\PresentationFramework.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Core.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.dll" -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Numerics.dll" -r:C:\Dev\ATF\tp\FsXaml\System.Windows.Interactivity.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Xaml.dll" -r:C:\Dev\ATF\assembly\Debug\tradingclasses.dll -r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\WindowsBase.dll" --target:exe --warn:3 --warnaserror:76 --vserrors --validate-type-providers --LCID:1033 --utf8output --fullpaths --flaterrors --subsystemversion:6.00 --highentropyva+ --sqmsessionguid:ed3396d7-c111-4f7c-91a2-bf3691c7001c "c:\temp.NETFramework,Version=v4.5.AssemblyAttributes.fs" atfgui.fs FSC: error FS3031: The type provider 'C:\Dev\ATF\tp\FsXaml\Debug\FsXaml.Wpf.TypeProvider.dll' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FsXaml.Wpf.TypeProvider' which cannot be loaded or doesn't exist. Could not load file or assembly 'file:///C:\Dev\ATF\tp\FsXaml\Debug\FsXaml.Wpf.TypeProvider.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. FSC: warning FS3005: Referenced assembly 'C:\Dev\ATF\tp\FsXaml\Debug\FsXaml.Wpf.TypeProvider.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found Done building project "atfgui.fsproj" -- FAILED.

+0

如果您使用的是VS,使用模板可能更容易? –

回答

2

的問題是實際上FsXaml和FsXaml的組成部分之一的CPU架構。我將我的代碼重新編譯爲AnyCPU而不是X64,以便與FsXaml兼容,因此它工作正常。

+0

我有非常類似的錯誤(可能是由於移動項目文件夾和手動編輯* .fsproj文件)。解決方案是將項目屬性中的** Target F#runtime **從4.3.0.0切換到4.3.1.0 - 瞧!它已編譯,但無法在運行時加載。切換回4.3.0.0將一切恢復正常。 VisualStudio可能在某個過程中「清理」了我的項目文件。 – MKaama