2013-08-12 40 views
6

爲什麼我不能創建類型提供程序作爲* .exe文件與[<TypeProviderAssembly()>][<EntryPoint>]裏面?F#類型提供程序編譯爲* .exe文件

當我嘗試TP使用#r @"d:\TP\bin\Debug\MyTypeProvider.exe"引用這樣的,我看到以下內容:

test.fsx(3,1): error FS3031: The type provider 'd:\TP\bin\Debug\MyTypeProvider.exe' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'MyTypeProvider' which cannot be loaded or doesn't exist. Could not load file or assembly 'file:///d:\TP\bin\Debug\MyTypeProvider.dll' or one of its dependencies. The system cannot find the file specified.

我需要有單獨的進程類型推斷運行,因爲它應該是64bit(不像32bit VS進程)。但我想將所有東西打包到一個文件中,從VS引用它並作爲外部進程啓動。

回答

2

也許有一些好的潛在原因,總是尋找DLL而不是EXE,但我懷疑這可能是一個任意的限制。

如果我將程序集的全名提供給TypeProviderAssemblyAttribute構造函數(例如[<TypeProviderAssembly("MyExe, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")>]),但我無法使用IntelliSense,但無法使用其他項目的TP,因此我可以在FSI中使用該函數。考慮向團隊提交一個錯誤 - 但如果你能證明爲什麼你需要一個EXE而不是你的場景中的DLL,這可能會有所幫助。

+0

TP應該能夠連接到SharePoint。它只能從64位進程中獲得。 VS是'32bit'應用程序,這也意味着智能感知。我不能直接從類型提供者那裏做。我看到的唯一可能的解決方案是啓動單獨的64位進程並使用WCF命名管道在它們之間進行通信。將服務和客戶端打包成一個exe將會很好。 –

+0

你可以看看[當前實現](https://github.com/sergey-tihon/PowerShellTypeProvider)。但我想將這些項目合併爲一個。我認爲在這種情況下,它會更容易使用。 –

相關問題