2015-05-03 46 views
4

如何參考GAC中最新的Microsoft.Build.fsx在F#Interactive中引用最新的Microsoft.Build GAC程序集?

當我做#r "Microsoft.Build"我總是得到版本4.0.0,但我想要12.0.0加載。

enter image description here

#r "Microsoft.Build" 
open Microsoft.Build.Evaluation 
printfn "%s" typeof<ProjectCollection>.Assembly.Location 

這將幫助我solve this issue

編輯#1:

做一個完全合格的組件名稱並沒有爲我工作:

enter image description here

編輯#2:

我需要最新的這可能是不同的不同的系統。我希望這會起作用。 :(

#I @"C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Build\v4.0_14.0.0.0__b03f5f7f11d50a3a" 
#I @"C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Build\v4.0_12.0.0.0__b03f5f7f11d50a3a" 
#r "Microsoft.Build" 
open Microsoft.Build.Evaluation 
printfn "%s" typeof<ProjectCollection>.Assembly.Location 

enter image description here

好消息是,它現在是開源的,因爲沒有這個工程,我想,我目前正在建設一個岔路口。我可能會SourceLink.MSBuild重命名爲。避免衝突

回答

2

我從來沒有嘗試過這一點,但我希望你可以使用fully-qualified assembly name

#r "Microsoft.Build, Version=12.0.0.0 ... 

編輯:

好了,這樣是不行的,但是這並不:

#r @"C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.Build\v4.0_12.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.dll" 
+0

我已經試過了,但它並沒有爲我工作。我附上了上面的截圖。 –

+0

@CameronTaggart你說得對。顯然你必須提供實際文件的路徑。上面的例子。 – phoog

+0

這確實可以在帶有msbuild 12的系統上工作,但是帶有msbuild 14的系統呢?參見編輯#2。我不認爲這是可能的。 –

相關問題