Open mgmccarthy opened 6 years ago
That error is usually a result of the machine having (incorrectly) had Microsoft.Build.*
assemblies added to the GAC. Can you try running these commands from an administrator developer command prompt?
gacutil /u "MSBuild, Version=15.1.0.0"
gacutil /u "Microsoft.Build.Conversion.Core, Version=15.1.0.0"
gacutil /u "Microsoft.Build, Version=15.1.0.0"
gacutil /u "Microsoft.Build.Engine, Version=15.1.0.0"
gacutil /u "Microsoft.Build.Tasks.Core, Version=15.1.0.0"
gacutil /u "Microsoft.Build.Utilities.Core, Version=15.1.0.0"
gacutil /u "Microsoft.Build.Framework, Version=15.1.0.0"
does that include msbuild 14.x assemblies that were added by VS 2015? We are having this issue and the commands you listed above didnt uninstall anything. VS 2017 version 15.8.28010.2036.
@fifthgearonline MSBuild 14.0 assemblies should be in the GAC if VS 2015 or Build Tools 2015 is installed. What is the exact error you're getting?
@rainersigwald Same issue when loading a .csproj using MSBuildWorkspace. It was working when i had only VS2015 installed, but since I installed vs2017, I get this error : -- ERROR: Msbuild failed when processing the file 'D:\DCGF_KillCA\Externals\XRoslyn\MyTypes\MyTypes.csproj' with message: Invalid static method invocation syntax: "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries($(TargetFrameworkIdentifier), $(TargetFrameworkVersion), $(TargetFrameworkProfile), $(PlatformTarget), $(TargetFrameworkRootPath), $(TargetFrameworkFallbackSearchPaths))". Méthode 'Microsoft.Build.Utilities.ToolLocationHelper.GetPathToStandardLibraries' introuvable. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a
, b
)). C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets
Previously, I assume it was doing stuff in C:\Program Files (x86)\Microsoft Visual Studio\2015.... and it was working
The code : var lBuildConfiguration = new Dictionary<string, string> { { "Configuration", "Release" }, // Or "Debug", or whatever is known to your projects. { "Platform", "x86" }, // Or x64, AnyCPU, etc... { "CheckForSystemRuntimeDependency", "true" } // ... more properties that could influence your property, };
this.mWork = MSBuildWorkspace.Create( lBuildConfiguration );
this.mWork.LoadMetadataForReferencedProjects = true;
this.mWork.SkipUnrecognizedProjects = false;
// Load the project straight.
this.mProject = this.mWork.OpenProjectAsync( pProjectPath ).Result;
Can we force a MSbuild version in config strings?
I suspecte when trying to load a csproj (inducing there is no solution at open time) MSbuildWorkspace create a default one to load my csproj in it. In the case there was only VS2015, the default solution created was VS2015, but now there is vs2017, the default solution MSbuildWorkspace is creating is a VS2017 temp sln which attempt to load a csproj vs2015 formatted that obviously mismatches in matter of (MSBuildExtensionsPath)\$(MSBuildToolsVersion) or whatever...
I started getting this exact issue after a visual studio upgrade.
~~Does it make a difference that I am relying on this workaround? (from https://github.com/Microsoft/msbuild/issues/2369):
Environment.SetEnvironmentVariable("MSBUILD_EXE_PATH", @"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe");
~~
Oh and I do not get any 15.x versions listed when executing gacutil /l Microsoft.Build
Edit: Upgraded Microsoft.Build to 15.9.20 and Microsoft.CodeAnalysis to 2.10.0 and no longer need workaround. Issue remains.
That error is usually a result of the machine having (incorrectly) had
Microsoft.Build.*
assemblies added to the GAC. Can you try running these commands from an administrator developer command prompt?gacutil /u "MSBuild, Version=15.1.0.0" gacutil /u "Microsoft.Build.Conversion.Core, Version=15.1.0.0" gacutil /u "Microsoft.Build, Version=15.1.0.0" gacutil /u "Microsoft.Build.Engine, Version=15.1.0.0" gacutil /u "Microsoft.Build.Tasks.Core, Version=15.1.0.0" gacutil /u "Microsoft.Build.Utilities.Core, Version=15.1.0.0" gacutil /u "Microsoft.Build.Framework, Version=15.1.0.0"
Amazing this works for me, I have had upgraded VS2017 to 15.9.12 and started having an issue with error Method not found: 'Int32 Microsoft.Build.Execution.ProjectInstance.get_EvaluationId()'.
Thanks
Posted in developercommunity.visualstudio.com as well: https://developercommunity.visualstudio.com/content/problem/333202/error-after-updating-to-1582-when-running-unit-tes.html
After upgrading to Visual Studio 2017 v15.8.2 and running rosyln-based unit tests, they all fail.
The failure is on the line of code at workspace.Diagnostics.Any query:
Full stack trace: Msbuild failed when processing the file 'D:\Projects\IXRS\Study\IXRS.Client.Web.Tests\IXRS.Client.Web.Tests.csproj' with message: Invalid static method invocation syntax: "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries($(TargetFrameworkIdentifier), $(TargetFrameworkVersion), $(TargetFrameworkProfile), $(PlatformTarget), $(TargetFrameworkRootPath), $(TargetFrameworkFallbackSearchPaths))". Method 'Microsoft.Build.Utilities.ToolLocationHelper.GetPathToStandardLibraries' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(
a
, b)). C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targetsThings I've Tried
Update Microsoft.CodeAnalysis package from 2.6.1 to 2.9.0 (and all subsequent dependencies that go along with that package).
This didn't work as once the upgrade was done, the compiler threw an exception that is no longer recognized MSBuildWorkspace
I then went out to find the missing NuGet package (where MSBuildWorkspace was moved to) and installed it:
the compiler error went away, but the same exact exception was thrown when running the roslyn-based tests
I THINK this is an MSBuild issue... just strange that upgrading to VS 2017 v15.8.2 would cause this type of failure.