I have a web project that won't build because of a nuget error.
We have many websites that all use a web CMS called Sitecore. Our different websites work under different versions. Thus, we have a common library that targets many versions as described here.
So, I have a project structure like seen below. Please keep in mind this is a logical representation. Consider all these files being at the root of the solution.
- Common.sln
- Common.SC65.csproj
- MyClass.cs [shared]
- MyClass.SC65.cs
- packages.Common.SC65.config
- Common.SC70.csproj
- MyClass.cs [shared]
- MyClass.SC70.cs
- packages.Common.SC70.config
- Common.SC72.csproj
- MyClass.cs [shared]
- MyClass.SC72.cs
- packages.Common.SC72.config
- Common.SC65.csproj
This is the error I'm having now:
C:\Path\Website.ProjectSC65\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets(225,5): error : Could not locate C:\Path\Common\packages.config. Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file.
That leads me to believe that the problem lies in that Bcl targets file, and it seems to be yelling about this line:
<ValidatePackageReferences Packages="@(ValidatePackages)" ReferencingProject="$(BclBuildReferencingProject)" ReferencingProjectPackagesConfig="$(BclBuildReferencingProjectConfig)" ReferencedProject="$(MSBuildProjectFullPath)" ReferencedProjectPackagesConfig="$(MSBuildProjectDirectory)\packages.config" TreatWarningsAsErrors="$(TreatWarningsAsErrors)" />
"Website.ProjectSC65" has a reference to Common.SC65.
I have occasionally had weird problems with nuget packages acting funny, but I can't seem to shake this issue no matter what I do. Mostly some Update-Package -reinstall
combination solves my issues. I need these different packages per project, as they support different versions of the framework.
I am fully aware that it is looking for a packages file that doesn't exist technically, as it should be referencing 'packages.Common.SC65.config'.
What's weirder still, I can't find anything on the internet now that references the above technique to reference project level dependencies. I know I found this at one point, but I have no idea if this is how it should be done.
So, the main things I need to know:
- What could be causing the error above in my project build, and how would I fix it?
- What is the proper way of setting up nuget packages on a project level? (not a solution level)