Hi @Santu Modak ,
Welcome to Microsoft Q&A!
Please go to the project folder and check if you can find the NuGet package Microsoft.Net.Compilers in the packages.config file or packages
folder.
<package id="Microsoft.Net.Compilers" version="2.4.0" targetFramework="xxx" />
If you can’t find the NuGet package, maybe it is not installed properly. You can remove all snippets about this package in the project file (updatecomp_project.csproj). Then, reload the project and rebuild the project.
If you can find it, please go to .csproj file and check that the path is correct like the following:
<HintPath>..\packages\Microsoft.Net.Compilers.2.4.0\xxxx</HintPath>
Please correct the path and restore the package in Visual Studio.
If it doesn’t work, you can try to remove the following snippet in the .csproj file:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.4.0\xxxx')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.4.0\xxxx'))" />
Then, reinstall the packages via Package Manager Console (Tools > NuGet Package Manager):
Update-Package -reinstall
Sincerely,
Anna
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.