I'm getting this weird error when trying to build my project:
Error: The reference to the built-in metadata "FileName" at position 1 is not allowed in this condition "'%(FileName)' != 'netstandard'". C:\github\VS\API\VS.API.Public\VS.API.Public.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
at Microsoft.Build.Evaluation.Parser.Parse(String expression, ParserOptions optionSettings, ElementLocation elementLocation)
at Microsoft.Build.Evaluation.ConditionEvaluator.EvaluateConditionCollectingConditionedProperties[P,I](String condition, ParserOptions options, Expander`2 expander, ExpanderOptions expanderOptions, Dictionary`2 conditionedPropertiesTable, String evaluationDirectory, ElementLocation elementLocation, ILoggingService loggingServices, BuildEventContext buildEventContext, ProjectRootElementCache projectRootElementCache)
at Microsoft.Build.Execution.ProjectInstance.EvaluateCondition(String condition)
at JetBrains.Platform.MsBuild.TaskCommon.ProjectModel.Bindings.AddWildcardItemsFromXml(ProjectRootElement element, Boolean isImported, ProjectInstance projectInstance, List`1 items)
at JetBrains.Platform.MsBuild.TaskCommon.ProjectModel.Bindings.BindWildcardItems(Project project, ProjectInstance projectInstance)
at JetBrains.Platform.MsBuild.TaskCommon.ProjectModel.Bindings.Bind(Project project, ProjectInstance projectInstance, List`1 targetErrors, List`1 targetWarnings, Dictionary`2 resultsByTarget)
at JetBrains.Platform.MsBuild.TaskCommon.ProjectModel.Bindings.Bind(Project project, ProjectInstance projectInstance)
at JetBrains.Platform.MsBuild.TaskCommon.Build.BuildSessionHost.HandleSubmissionFinished(RdBuildRequest request, ProjectWithEvents projectWithEvents, Boolean succeeded, RdTask`1 rdTask)
I have no clue what this error means and where to even start. It's a Web API project, and this appears in the Build Results window in Visual Studio when I do a Rebuild on the project.
The error mentions a problem with this condition: '%(FileName)' != 'netstandard'
in the .csproj file. But this doesn't appear when doing a search in the .csproj file.
If I do a search in all files within the solution folder, I can find an occurance of it in C:\github\vs\packages\NETStandard.Library.2.0.1\build
:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<NETStandardLibraryPackageVersion>2.0.1</NETStandardLibraryPackageVersion>
</PropertyGroup>
<ItemGroup Condition="'$(_NetStandardLibraryRefPath)' != ''">
<Reference Include="$(_NetStandardLibraryRefPath)*.dll">
<!-- Private = false to make these reference only -->
<Private>false</Private>
<!-- hide these from Assemblies view in Solution Explorer, they will be shown under packages -->
<Visible>false</Visible>
<Facade Condition="'%(FileName)' != 'netstandard'">true</Facade>
<NuGetPackageId>NETStandard.Library</NuGetPackageId>
<NuGetPackageVersion>$(NETStandardLibraryPackageVersion)</NuGetPackageVersion>
</Reference>
<ReferenceCopyLocalPaths Condition="'$(_NetStandardLibraryLibPath)' != ''" Include="$(_NetStandardLibraryLibPath)*.dll">
<Private>false</Private>
<Facade Condition="'%(FileName)' != 'netstandard'">true</Facade>
<NuGetPackageId>NETStandard.Library</NuGetPackageId>
<NuGetPackageVersion>$(NETStandardLibraryPackageVersion)</NuGetPackageVersion>
</ReferenceCopyLocalPaths>
</ItemGroup>
</Project>
But I don't know enough about how .targets files work to know how to resolve this... normally it just works.
I also can't find any relevant results if I try to google this error. Does anybody know whats going wrong here?
I'm using Visual Studio Professional 15.6.0. The project targets .net462.