Last post Dec 05, 2016 04:21 PM by julianonunes
Nov 29, 2016 06:12 PM|julianonunes|LINK
I have my project running on localhost and production, however because of the slow first access of each view, I'm trying to publish it precompiled (Precompile during publishing > (Disabled) Allow precompiled site to be updatable).
I saw that the errors are all related to my ViewModel classes (which I repeat, they work correctly on localhost and on production without precompiling).
The type or namespace name 'ChangePasswordViewModel' does not exist in the namespace 'ProjectName.Models' (are you missing an assembly reference?)
I already deleted the entire content of the Temporary ASP.NET Files\root\,
bin and obj folders.
Even publishing to local path gives the same error.
Nov 30, 2016 09:56 AM|Chris Zhao|LINK
The error can result from different actions.
Reference an Assembly That Is Not Included in the Client Profile
Reference a Project or Assembly That Targets a Different Version of the .NET Framework
Re-Target a Project to a Different Version of the .NET Framework
Re-Target a Project to a Different Version of the .NET Framework and References Do Not Resolve
Compiler Error CS0234
Troubleshooting .NET Framework Targeting Errors
Nov 30, 2016 10:17 AM|julianonunes|LINK
It's a single project solution and I'm it is not set for Client Profile. All references has been added via Nuget Packages and the app is working on development and production environments. The only thing that is not working is the precompile option from
the publish feature.
Dec 02, 2016 08:59 AM|Chris Zhao|LINK
Rebuild your solution. Then look at your error list, double click on the error in the Error list.
There has to be a namespace called ProjectName.Models that has a class called ChangePasswordViewModel that is public.
public class ChangePasswordViewModel
Dec 02, 2016 09:21 AM|julianonunes|LINK
There are no compilation errors. The classes from my ViewModel folder are all correctly used if not precompiled.
Dec 05, 2016 04:21 PM|julianonunes|LINK
For documentation purposes I'm posting the solution to my problem.
The ASP.Net MVC project template creates authentication classes on project root, then I moved these classes to an area and replaced the namespace.
Then the problem was that some Views didn't get the new namespace. After fixing the `@model` references, the publish feature worked.