I am unable to successfully build the solution on the TFS server. Although, it looks like all of my NuGet packages restored, I keep getting the error Error CS0246: The type or namespace name 'MyAssembly' could not be found (are you missing a using directive or an assembly reference?). FYI this successfully builds on my local environment.
Build Steps
Here is what I have provided for the build steps:
NuGet Restore
These are the inputs I have provided while everything else uses the default value:
- Path to solution or packages.config: $/MyApp/MyApp/MyApp.sln
- Path to NuGet.config: $/MyApp/MyApp/NuGet.Config
- Installation type: Restore
Inside my NuGet.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="My Packages" value="\\server\Nuget Packages" />
</packageSources>
</configuration>
When this build step runs, it succeeds and says:
All packages listed in packages.config are already installed
Build Solution
These are the inputs I have provided while everything else uses the default value:
- Solution: $/MyApp/MyApp/MyApp.sln
When this build step runs, I get errors similar to:
Error CS0246: The type or namespace name 'MyAssembly' could not be found (are you missing a using directive or an assembly reference?)
Folder Structure
Here is the folder structure of the solution and the package.configs
- MyApp
- MyApp.Core
- package.config
- MyApp.Web
- package.config
- NuGet.Config
- MyApp.sln
- MyApp.Core
Any suggestions would be helpful and please let me know if additional information needs to be provided. Thanks!
NuGet will check the packages directory for the solution when it restores.
It checks that this packages directory contains the .nupkg and manifest file for the NuGet package and if so it believes the NuGet package is already installed.
So, to resolve the issue, you should make sure you are not add the
\packagesfolder in to source control. If yes, please try to remove it out of source control.Hope this helps.