Understanding The Difference Between Deployment Files and Source Code

People often download the pre-compiled deployment packages of mojoPortal and then try to use it in Visual Studio and then they wonder why there is no source code. The pre-compiled deployment files are intended for production deployment, they are pre-compiled and have no C# source code. If you want to work in Visual Studio and do custom development you should get the source code from our source code repository.

What you need to understand is the Visual Studio supports 2 kinds of web projects, Web Application Projects and Web Site Projects. In a Web Site project there is no .csproj file and it treats all files as part of the project, whereas in a Web Application Project there is a .csproj file that lists all the files that are part of the project and other files may exist on disk but are not really part of the project and VS will not try to compile files that are not part of the project. Furthermore when you compile a Web Application Project, all the C# code is compiled into a dll in the /bin folder and the C# source code is not intended to be deployed to production whereas in a Web Site project the C# files are not typically pre-compiled into the /bin folder but are compiled by the ASP.NET runtime into temporary files down below the Windows directory. Another point of note is that in both project types the .aspx files and .ascx files are also compiled into temporary files. Basically you can think of the .aspx and .ascx files as partial classes and the other parts of the partial class are in the code behind, but in Web Application projects the code behind is pre-compiled into the dll in the bin folder so only the .aspx and .ascx parts have to be compiled into temporary files by the ASP.NET runtime.

mojoPortal Web (in mojoPortal source code) is a Web Application Project not a Web Site Project. However what happens often enough is that people try to use our pre-compiled deployment files in Visual Studio and since there is no .csproj file Visual Studio opens it as a Web Site Project and treats all the files as part of the project so if there are any extra C# files in the file system it will treat those as part of the project and try to compile them, so occasionally there may be a stray file there that causes an error when you open the pre-compiled files in Visual Studio but typically we do try to avoid any extra files in the deployment packages so that there will be no error if you open it in VS but really if you want to work with the source code you should use the source code from the repository.

If you then try to "Publish" the project from Visual Studio, and if the publish settings are configured to "pre-compile" then what happens is that it will pre-compile all of the .aspx, .ascx files as a web site and VirtualPathProviders don't work in pre-compiled web site projects and this breaks the skin because in mojoPortal we use a VirtualPathProvider to make it load the theme.skin file from the skin folder under /Data/Sites/[SiteID]/skins/[skinname] instead of from the /App_Themes folder. You "could" possibly copy the theme.skin file from the skin folder into /App_Themes/default but then you will be limited in your ability to use different theme settings per skin so some skins will be broken and others may work. So it is best not to re-compile and re-publish the mojoPortal release packages because they originated from a web app project not a web site project and they are already compiled and published to create the release/deployment packages.