c# – AssemblyInfo and RazorAssemblyInfo files are not found in ASP.NET Core MVC project


I have been working on an ASP.NET Core MVC / C# project (Visual Studio 2022) for the last 2 months. I have a class in this project which contains some properties. The name of the property was in capital letters and it was working fine.

Today I changed the name of the property from capital letters to lowercase letters of that class – something like this:

public string STUD_NAME { get; set; }

to

public string stud_name { get; set; }   

After changing this, when I tried to run the app, it shows 2 errors:

The source file ~\ProjectName\obj\Debug\net6.0\AssemblyInfo.cs

and

~\ProjectName\obj\Debug\net6.0\RazorAssemblyInfo.cs – could not find these files.

But when I checked in the specific obj folder, these files are there.

But in the Solution Explorer, I couldn’t find these 2 files anywhere including the Properties folder.

I removed this obj folder and recreated it by rebuilding the project. Still it shows the same errors. I cleaned the project and solution and rebuild it. Still shows same error.

Project properties as shown below:

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

     <PropertyGroup>    
       <TargetFramework>net6.0</TargetFramework>
       <Nullable>enable</Nullable>
       <ImplicitUsings>enable</ImplicitUsings>
       <RootNamespace>AMD_WEB</RootNamespace>
       <DockerDefaultTargetOS>Windows</DockerDefaultTargetOS>
       <DockerfileContext>.</DockerfileContext>
       <DockerComposeProjectPath>docker- 
           compose.dcproj</DockerComposeProjectPath>
       <UserSecretsId>9e0b460e-16bd-42c2-b790- 
           6fe2edd2b425</UserSecretsId>
   </PropertyGroup>

   <ItemGroup>
       <PackageReference Include="ClosedXML" Version="0.97.0" />
       <PackageReference            
  Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" 
  Version="6.0.11" />
      <PackageReference 
  Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" 
  Version="1.17.0" />
  <PackageReference 
   Include="Microsoft.VisualStudio.Azure.Kubernetes.Tools.Targets" 
   Version="1.1.0" />
   <PackageReference 
   Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" 
   Version="6.0.16" />
   <PackageReference Include="Oracle.EntityFrameworkCore" 
   Version="7.21.11" />
   <PackageReference Include="System.Security.Cryptography.Pkcs" 
   Version="7.0.3" />
 </ItemGroup>

</Project>

How to solve this issue?

Leave a Reply

Your email address will not be published. Required fields are marked *