Reputation: 704
I've encountered a weird error today when trying to manage nuget packages on a unit test project in my solution:
I took a look at the documentation for this property: https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2019 and it mentions that this property is part of a props or a target file. My solution does not have one of these. I went ahead and modified the csproj to add the property:
<MSBuildProjectExtensionsPath />
to the appropriate build propertygroup, and it didn't detect it either. I looked at another project that lets me work with nuget packages successfully and it doesn't have the property at all.
Anyone know what's going on?
Upvotes: 1
Views: 10132
Reputation: 56
MSBuildProjectExtensionPath
is defined at Microsoft.Common.props
<MSBuildProjectExtensionsPath>$([MSBuild]::EnsureTrailingSlash($([MSBuild]::ValueOrDefault('$(MSBuildProjectExtensionsPath)', '$(BaseIntermediateOutputPath)'))))</MSBuildProjectExtensionsPath>
So you may miss to import that file in your project begining.
<Import Project="$(MSBuildExtensionsPath)$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)$(MSBuildToolsVersion)\Microsoft.Common.props')" />
Upvotes: 2
Reputation: 21
You probably accidentally removed the following line from your project file:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Upvotes: 2
Reputation: 704
I gave up trying to figure it out. I created a new project and put in my code files/references.
Upvotes: -2