Warm tip: This article is reproduced from serverfault.com, please click

Build errors ONLY occur when publishing

发布于 2016-03-30 18:05:04

I'm trying to publish my project which has references to other projects in my solution.

Whenever I build the solution regularly it builds just fine without any errors.

However, whenever I attempt to publish the project I get the message "Build failed".

When I check the output log I see the following 3 errors:

C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\RealestateJobsMigrations\RealestateJobsConfiguration.cs(10,101,10,124): error CS0234: The type or namespace name 'RealestateJobsDbContext' does not exist in the namespace 'RealestateScraper' (are you missing an assembly reference?)

C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\RealestateJobsMigrations\RealestateJobsConfiguration.cs(18,56,18,79): error CS0234: The type or namespace name 'RealestateJobsDbContext' does not exist in the namespace 'RealestateScraper' (are you missing an assembly reference?)

C:\Users\MyUsername\Dropbox\Projects\SEO\QualityLinkBuilder\Web\ViewModels\JobsVm.cs(364,51,364,69): error CS0246: The type or namespace name 'ClosedRealestateId' could not be found (are you missing a using directive or an assembly reference?)

However, I have referenced the project "RealestateScraper" and the class RealestateJobsDbContext&ClosedRealestateId exists in the "RealestateScraper" project root namespace which HAS been marked as using in the locations where the output marked the errors.

(like I previously stated, the project builds fine too when not publishing).

What could be the issue here? I have cleaned&rebuilt but that doesn't seem to change anything.

Note: I'm not showing the code with the errors since it seems to serve no purpose as I am referencing the assemblies in the files correctly (using RealestateScraper;)

Questioner
J. Doe
Viewed
11
J. Doe 2016-03-31 02:23:25

Apparently in the RealestateScraper project I was referencing another project .dll at a location where it no longer existed. I updated the reference location and it fixed it.