rubenfa
rubenfa

Reputation: 851

Compilation error on IIS after deploy folders with Visual Studio Publish

We are deploying a MVC project by using Publish option of Visual Studio 2015. When we copy all files to the server we get an awful error:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: BC30451: 'Styles' is not declared. it may be inaccessible due to its protection level

The fun part is that if we compile the project manually in release mode, and then copy bin and views folders to server, it works again.

Somebody can help us?

Upvotes: 0

Views: 831

Answers (2)

rubenfa
rubenfa

Reputation: 851

Finally, we have found out where the problem was.

The web.config file within Views folder was excluded from the project (who knows why?). This file contains razor configuration (like Styles.Render). When we were publishing the project, this file was not being copied, so the compile process in the server was failing.

Upvotes: 0

Denis
Denis

Reputation: 90

I had some errors like that when some files (like views) were saved in the file system but were not included into Visual studio project. Check if all neccessary files are included into the project.

Upvotes: 1

Related Questions