Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legacy .csproj files always show "Invalid static method invocation syntax" error #14

Closed
llaughlin opened this issue Feb 13, 2019 · 9 comments

Comments

@llaughlin
Copy link

llaughlin commented Feb 13, 2019

I am always seeing this error when looking at "older" .csproj files (those not using the new structure that includes <PackageReference>s.

Invalid static method invocation syntax: "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries($(TargetFrameworkIdentifier), $(TargetFrameworkVersion), $(TargetFrameworkProfile), $(PlatformTarget), $(TargetFrameworkRootPath), $(TargetFrameworkFallbackSearchPaths))". Microsoft.Build.Utilities.ToolLocationHelper.GetPathToStandardLibraries Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a, b)).c:\repo\master\FileSystem\FileSystem.csproj(MSB4186)

Here is an example .csproj file that generates the issue:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProjectGuid>{636A7C3E-8D20-4696-A641-1F5180F0440C}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>FileSystem</RootNamespace>
    <AssemblyName>FileSystem</AssemblyName>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\x86\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
    <OutputPath>bin\x86\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <Optimize>true</Optimize>
    <DebugType>pdbonly</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
      <HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
    </Reference>
    <Reference Include="PresentationCore" />
    <Reference Include="System" />
    <Reference Include="System.Configuration" />
    <Reference Include="System.Core" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Management" />
    <Reference Include="System.Web" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="WindowsBase" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="DirectoryUtilility.cs" />
    <Compile Include="FileSystemUtility.cs" />
    <Compile Include="NativeMethods.cs" />
    <Compile Include="GroupedProcessUtility.cs" />
    <Compile Include="ImageUtility.cs" />
    <Compile Include="PathConfigurations.cs" />
    <Compile Include="PathConfigurationsSection.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="UncHelper.cs" />
    <Compile Include="VideoUtility.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="packages.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

I haven't been able to identify the root cause (I'm unfamiliar with the ToolLocationHelper).

Am I missing an upgrade or dependency somewhere?

I have the following installed:

  • Visual Studio 2017 Enterprise 15.9.7
  • Visual Studio 2019 Enterprise 16.0.0 Preview 2.1
  • Visual Studio Code 1.31.1

And this is the output for dotnet --info:

.NET Core SDK (reflecting any global.json):                                                                  
 Version:   2.2.103                                                                                          
 Commit:    8edbc2570a                                                                                       
                                                                                                             
Runtime Environment:                                                                                         
 OS Name:     Windows                                                                                        
 OS Version:  10.0.17763                                                                                     
 OS Platform: Windows                                                                                        
 RID:         win10-x64                                                                                      
 Base Path:   C:\Program Files\dotnet\sdk\2.2.103\                                                           
                                                                                                             
Host (useful for support):                                                                                   
  Version: 2.2.1                                                                                             
  Commit:  878dd11e62                                                                                        
                                                                                                             
.NET Core SDKs installed:                                                                                    
  1.1.11 [C:\Program Files\dotnet\sdk]                                                                       
  1.1.12 [C:\Program Files\dotnet\sdk]                                                                       
  2.1.4 [C:\Program Files\dotnet\sdk]                                                                        
  2.1.100 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.101 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.104 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.201 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.202 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.301 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.400 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.401 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.402 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.403 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.500 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.502 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.503 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.504 [C:\Program Files\dotnet\sdk]                                                                      
  2.1.600-preview-009426 [C:\Program Files\dotnet\sdk]                                                       
  2.1.600-preview-009472 [C:\Program Files\dotnet\sdk]                                                       
  2.2.102 [C:\Program Files\dotnet\sdk]                                                                      
  2.2.103 [C:\Program Files\dotnet\sdk]                                                                      
                                                                                                             
.NET Core runtimes installed:                                                                                
  Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]                   
  Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]                   
  Microsoft.NETCore.App 1.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                        
  Microsoft.NETCore.App 1.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                        
  Microsoft.NETCore.App 1.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                        
  Microsoft.NETCore.App 1.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                        
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
  Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]                         
@tintoy
Copy link
Owner

tintoy commented Feb 13, 2019

I wonder if this is related to #1... Let me have a look and get back to you.

@tintoy
Copy link
Owner

tintoy commented Feb 13, 2019

What version of the extension are you using?

@llaughlin
Copy link
Author

The latest: 0.2.51

Name: MSBuild project tools
Id: tintoy.msbuild-project-tools
Description: Tools for working with MSBuild project files (such as auto-complete for package Ids / versions).
Version: 0.2.51
Publisher: tintoy
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=tintoy.msbuild-project-tools

@tintoy
Copy link
Owner

tintoy commented Feb 13, 2019

Hmm, looks like I need to upgrade the Microsoft.Build packages referenced by the language server again (just tried this locally and I can then open the project and see correct intellisense for it).

If I build a custom VSIX would you be willing to try it out for me?

tintoy added a commit that referenced this issue Feb 13, 2019
tintoy added a commit to tintoy/msbuild-project-tools-vscode that referenced this issue Feb 13, 2019
@llaughlin
Copy link
Author

Of course!

@tintoy
Copy link
Owner

tintoy commented Feb 13, 2019

You can download the VSIX here (instructions for install are listed there, too).

@llaughlin
Copy link
Author

I'll try it out and let you know the results. Thanks so much for the quick response!

@llaughlin
Copy link
Author

Yep! That works perfectly. I intellisense and autocomplete are working as expected now.

@tintoy
Copy link
Owner

tintoy commented Feb 13, 2019

Ok, thanks - will publish it then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants