I have a small C# solution.
The solution contains the main project and a test project.
When I run a basic build pipeline, I get an error CS0246 while building the test project as it can't access the main project.
Solution builds fine locally.
Have I missed something obvious?
The error seems to be due to a library issue.
One or the other NuGet package installed in your application is not restored.
Can you check if you have restored the NuGet packages in your DevOps build pipeline?
As build is a separate environment than your Visual Studio where the application was developed, so you will have to restore the NuGet package first before building the C# project.
You can find more information here to see how to restore a NuGet package inside build pipeline
First, make sure you have used Nuget task with restore command to restore the dependency packages in the pipeline. If the problem persists, you can check if there are any conflicts between the packages you have in source control and the package you are trying to restore.
In addition, you can try to disable the local cache in the build definition. The local cache may only be partially filled.
Here is a ticket with similar issue you can refer to.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.