Skip to content

Commit

Permalink
Merge pull request #57 from rneatherway/msbuild14-loader
Browse files Browse the repository at this point in the history
Redirect not-found MSBuild 12 to 14
  • Loading branch information
rneatherway committed Aug 10, 2015
2 parents 1ef45be + 5380c43 commit b4cb67e
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
6 changes: 5 additions & 1 deletion FsAutoComplete.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
Expand All @@ -12,6 +11,11 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsAutoComplete", "FsAutoCom
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsAutoComplete.Tests", "FsAutoComplete.Tests\FsAutoComplete.Tests.fsproj", "{F5EBDD99-5ED7-4311-A5CB-7CFCE696FF88}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E1A34828-1EA8-44F8-8377-10DCC312EB8B}"
ProjectSection(SolutionItems) = preProject
build.fsx = build.fsx
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
22 changes: 22 additions & 0 deletions FsAutoComplete/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>

<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>

</runtime>

</configuration>
12 changes: 12 additions & 0 deletions FsAutoComplete/CompilerServiceInterface.fs
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,15 @@ type FSharpCompilerServiceChecker() =
with e ->
Failure e.Message

open System.Reflection
module CompilerServiceInterface =
let addMSBuildv14BackupResolution () =
let onResolveEvent = new ResolveEventHandler( fun sender evArgs ->
let requestedAssembly = AssemblyName(evArgs.Name)
if requestedAssembly.Name.StartsWith("Microsoft.Build") then
requestedAssembly.Version <- Version("14.0.0.0")
Assembly.Load (requestedAssembly)
else
null
)
AppDomain.CurrentDomain.add_AssemblyResolve(onResolveEvent)
2 changes: 1 addition & 1 deletion FsAutoComplete/FsAutoComplete.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<Compile Include="CommandInput.fs" />
<Compile Include="Program.fs" />
<None Include="FsAutoComplete.fsproj.paket.references" />
<None Include="build.fsx" />
<Content Include="App.config" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
Expand Down
5 changes: 3 additions & 2 deletions FsAutoComplete/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ module internal Main =
0

with e ->
let msg = "Unexpected internal error. Please report at\
https://github.com/fsharp/FsAutoComplete/issues,\
let msg = "Unexpected internal error. Please report at \
https://github.com/fsharp/FsAutoComplete/issues, \
attaching the following stack trace:\n"
+ e.Message + e.StackTrace
Response.error msg
Expand All @@ -264,6 +264,7 @@ module internal Main =
1
else
try
CompilerServiceInterface.addMSBuildv14BackupResolution()
async {
while true do
let cmd = CommandInput.parseCommand(Console.ReadLine())
Expand Down

0 comments on commit b4cb67e

Please sign in to comment.