-
Notifications
You must be signed in to change notification settings - Fork 55
VisualStudioVersion not passed along in LoadRelease #50
Comments
2012-08-21 Visual Studio project compatibility and VisualStudioVersion
Namespace: Microsoft.Build.Utilities.VisualStudioVersion Enumeration C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Microsoft.Build.dll I guess the reason ToolsVersion isn't used in the includes is so that each Visual Studio will use their own templates. I'm not sure this is always wise. |
This isn't a bug. The VisualStudioVersion can be set when load in the project file or defaulted in the project file. I like the idea of defaulting it to the $(ProjectToolsVersion). |
Closing. This is more of a build issue that was specific to AppVeyor. |
I'm reopening this in order to document how it works, if I can figure it out. |
Now that MSBuild is open source, we can see where I am using Microsoft.Build.Evaluation.Project to load the project files with the constructor to pass in the global properties. After several hours of troubleshooting on my system, the
#r "System.Xml"
#r "Microsoft.Build"
#r "Microsoft.Build.Framework"
open Microsoft.Build.Evaluation
open System.Collections.Generic
printfn "%s" typeof<ProjectCollection>.Assembly.Location
let pc = new ProjectCollection()
let d = Dictionary()
d.Add("Configuration", "Release")
let p = Project("vsversion.proj", d, null, pc)
let show = [ "MSBuildToolsVersion"; "MSBuildExtensionsPath"; "VisualStudioVersion" ] |> Set.ofList
p.Properties
|> Seq.filter (fun pr -> show.Contains pr.Name)
|> Seq.iter (fun pr ->
printfn "%s %s" pr.Name pr.UnevaluatedValue
)
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project> PS C:\Projects\SourceLink1> Fsi.exe .\vsversion.fsx
C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.dll
MSBuildToolsVersion 2.0
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project> MSBuildToolsVersion 4.0
VisualStudioVersion 11.0
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project> MSBuildToolsVersion 12.0
VisualStudioVersion 12.0
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project> MSBuildToolsVersion 14.0
VisualStudioVersion 14.0
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="C:\Projects\msbuild\src\XMakeTasks\Microsoft.Common.props" />
</Project> MSBuildToolsVersion 2.0
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="C:\Projects\msbuild\src\XMakeTasks\Microsoft.Common.props" />
</Project> MSBuildToolsVersion 11.0
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="C:\Projects\msbuild\src\XMakeTasks\Microsoft.Common.props" />
</Project> MSBuildToolsVersion 10.0
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="C:\Projects\msbuild\src\XMakeTasks\Microsoft.Common.props" />
</Project> MSBuildToolsVersion 10.0 I consider 7 & 8 to be bugs. I think this is the cause: Looking at the current SourceLink.fsproj:
That would have to be done before |
If there was an open source binary of the required MSBuild library, I would bundle it. Switching to this is sometimes a pain and
May be I can build my own source indexed MSBuild library to bundle. :-) |
The problem is that just doing a #r "Microsoft.Build"
open Microsoft.Build.Evaluation
printfn "%s" typeof<ProjectCollection>.Assembly.Location $env:path = "C:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0;$env:path" How do I reference the latest |
Asked on stackoverflow |
Fixed! The SourceLink.MSBuild used to publish it is here: Code is here: Blog post is in progress. |
When run on AppVeyor, the VsProj.LoadRelease, the
VisualStudioVersion
ends up evaluating to10.0
by default. Strangely, it ends up evaluating to11.0
when I set this inappveyor.yml
:My workaround was to pass in the property explicitly:
background:
FSharp.targets for VS 2013 (12.0) and VS 2015 (14.0), this is all that is needed:
VisualStudio will set the
VisualStudioVersion
property when build from within VisualStudio. When MSBuild is run from the command line, that property get set based onToolsVersion
."C:\Program Files (x86)\MSBuild\12.0\Microsoft.Common.props"
"C:\Program Files (x86)\MSBuild\12.0\Microsoft.VisualStudioVersion.v12.Common.props"
<VisualStudioVersion>12.0</VisualStudioVersion>
The text was updated successfully, but these errors were encountered: