Visual Studio 2022 - Issues with Custom MSBuild Targets Not Being Recognized in .NET 6 Project
I'm building a feature where I'm wondering if anyone has experience with I'm stuck on something that should probably be simple... This might be a silly question, but I'm currently facing an issue where my custom MSBuild targets are not being recognized in my .NET 6 project when building in Visual Studio 2022. I created a `.targets` file and included it in my project, but the build process doesn't seem to pick it up. Here’s the relevant portion of my `.csproj` file: ```xml <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net6.0</TargetFramework> </PropertyGroup> <Import Project="Custom.targets" /> </Project> ``` The `Custom.targets` file is located in the same directory as the `.csproj` file, and it contains the following: ```xml <Project> <Target Name="CustomBeforeBuild" BeforeTargets="Build"> <Message Text="Custom build step executed!" Importance="high" /> </Target> </Project> ``` When I run the build, I don’t see the message output, nor do I see any indication that `CustomBeforeBuild` is being executed. I’ve verified that the `.targets` file is indeed being imported by adding a basic `<Message>` task at the start of the file, which also does not appear in the build output. I’ve also tried clearing the Visual Studio cache and rebuilding the solution, but that didn’t help. Additionally, I've ensured that the MSBuild version in use is the one that comes with Visual Studio 2022. I’ve looked into the output verbosity settings in Visual Studio options and set them to diagnostic, yet there still isn’t any reference to my custom target in the output log. Am I missing something in the configuration, or is there something specific about .NET 6 projects that prevents custom targets from being recognized? Any help would be greatly appreciated! I recently upgraded to C# 3.11. I'd love to hear your thoughts on this. What are your experiences with this? I'm coming from a different tech stack and learning C#. Any help would be greatly appreciated! Any feedback is welcome!