Closed davidhesselbom closed 1 month ago
That's is an issue I've seen as well in VS2022. the import and $(MSBuildExtensionsPath) are not resolved correctly if the build fails for other reasons. Check for other errors/issues with your build. Once you resolve them, this error will go away.
But the build doesn't fail, the build completes and the game starts. I get this error even when building immediately after creating a new project from the KNI template and not changing anything. And I don't see any other errors, just this one. Where do you suggest looking for errors/issues other than the "Build Output" and "Error List" in Visual Studio?
I got the same error, but for "Kni.Content.Builder.targets". I found the file in "C:\Program Files (x86)\MSBuild\MonoGame\v3.0", but the msbuild called from Rider (which is also the one called from dotnet build) seems to look in "C:\Program Files\dotnet\sdk\8.0.101\MonoGame\v3.0" and the one called from Visual Studio 2022 in "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\MonoGame\v3.0" It seems they can't agree where "MSBuildExtensionsPath" is.
I am working on an alternative solution. Here's how you can test it:
1) open your .csproj 2) Remove this line at the end
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\Kni.Content.Builder.targets" />
3) Add this nuget package:
<ItemGroup>
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Builder" Version="3.10.9001-rc" />
</ItemGroup>
4) Save the .csproj and restore the packages (a rebuild from VS will do.)
The package is 34MB , it might take a while to restore the project the first time.
@nkast That seems to work
In v3.11 you can use
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Builder" Version="3.11.9001" />
as described above, or
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Builder.Windows" Version="3.11.9001" />
,,, in case your importer/processor require a full graphics backend.
I consider this resolved... closing.
After installing the SDK and creating a new project from template in VS2022, the project builds and runs, but I still get the following error in Visual Studio:
The same error is issued when building with
dotnet publish
, which aborts upon the error, however the commandmsbuild
completes without errors.The requested file is missing on my machine, indeed even the
Microsoft Visual Studio\2022\Community\MSBuild
folder does not exist. But again, the project still builds and runs, so why the error?