Issue with Project Reference

Anil Babu Ravi 5 Reputation points
2025-03-25T10:31:42.77+00:00

I am using visual studio 2022 with net9. C# unable to reference a class library project in another class

library project.

\Program Files\dotnet\sdk\9.0.201\Microsoft.Common.CurrentVersion.targets(2189,5): warning MSB9008: The referenced project \ProjectB\ProjectB.csproj does not exist.

folder structure

  • SolutionFolder
    • ProjectA
      • ProjectA.csproj
    • ProjectB
      • ProjectB.csproj

ProjectA.csproj:

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>

<TargetFramework>net9.0</TargetFramework>

<ImplicitUsings>enable</ImplicitUsings>

<Nullable>enable</Nullable>

</PropertyGroup>

<ItemGroup>

<ProjectReference Include="..\ProjectB\ProjectB.csproj" />

</ItemGroup>

</Project>

.NET Training
.NET Training
.NET: Microsoft Technologies based on the .NET software framework.Training: Instruction to develop new skills.
28 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Anil Babu Ravi 5 Reputation points
    2025-03-25T17:44:53.3433333+00:00

    targets file was corrupted. Reinstall .net 9 SDK issue got fixed

    1 person found this answer helpful.
    0 comments No comments

  2. Pradeep M 8,185 Reputation points Microsoft External Staff
    2025-03-26T05:38:43.1833333+00:00

    Hi Anil Babu Ravi,

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer. 

    Ask: Issue with Project Reference 

    Solution: targets file was corrupted. Reinstall .net 9 SDK issue got fixed 

    Please feel free to contact us if you have any additional questions.     

    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.