Publishing and Deploying Orchard 1.6

Topics: Administration, General
Jan 31, 2013 at 5:45 AM
Hi There

I would like to know how to publish orchard cms to a file system from VS 2012.

I have set up the project settings to "deploy all files in the folder" and to exclude any debug symbols.
The problem is that the created folders is over 500mb and all the obj folders in the core project and modules are not excluded.
Also the cs pages have not been compiled to dlls.

I was told that build.cmd can do this correctly but when I run it nothing happens.

Is there any way to publish and compile the solution correctly so that it is not so large or could anybody point me in the direction on how to use build.cmd correctly.

Also If I try and precompile the solution before publishing I get an object reference error.

Thanks
Stanton
Coordinator
Jan 31, 2013 at 7:25 AM
Right: do not set it up to deploy all files.

http://docs.orchardproject.net/Documentation/Building-and-deploying-Orchard-from-a-source-code-drop

You can also right-click on the Orchard.Web project and build package. It will do the right thing.
Oct 4, 2013 at 7:18 PM
Edited Oct 4, 2013 at 7:20 PM
Hi

Having problems publishing 1.7.1 full source in VS2010 to a local folder C:\Orchard\Publish1.7. Orchard site runs fine from source solution Orchard.Web through localhost.

Is there anywhere in the Orchard docs that provides the steps and settings needed to successfully do this so we can then FTP up to the server.

The steps I had that worked ok on full source 1.5 are:


__Build menu - Configuration Manager - Set to Release NOT DEBUG

Set - Only files needed to run this application AND Exclude generated debug symbols

WHICH ARE THE RIGHT SETTINGS FOR ITEMS TO DEPLOY ABOVE?


Build menu - Publish Orchard.Web - publish profile - release mode - set location and delete exising file

Press Publish
__


I tried right click on Orchard.Web for Build Deployment Package but this then required further use of CMD shell to further extract a zip.
All I really need to do is publish files to a folder and then FTP.

The published files are resulting in an 80mb folder - an error on localhost

__Object reference not set to an instance of an object.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader.<IsCompatibleWithModuleReferences>b__1e(ExtensionProbeEntry r) +0
System.Linq.Enumerable.All(IEnumerable1 source, Func2 predicate) +140
Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader.IsCompatibleWithModuleReferences(ExtensionDescriptor extension, IEnumerable1 references) +88
Orchard.Environment.Extensions.<>c__DisplayClassc.<ProcessExtension>b__a(ExtensionProbeEntry e) +20
System.Linq.Enumerable.FirstOrDefault(IEnumerable
1 source, Func2 predicate) +148
Orchard.Environment.Extensions.ExtensionLoaderCoordinator.ProcessExtension(ExtensionLoadingContext context, ExtensionDescriptor extension) +767
Orchard.Environment.Extensions.ExtensionLoaderCoordinator.SetupExtensions() +537
Orchard.Environment.DefaultOrchardHost.BuildCurrent() +110
Orchard.Environment.DefaultOrchardHost.Orchard.Environment.IOrchardHost.Initialize() +57
Orchard.Web.MvcApplication.HostInitialization(HttpApplication application) +69
Orchard.WarmupStarter.<>c__DisplayClass3.<LaunchStartupThread>b__2(Object state) +46

[ApplicationException: Error during application initialization]
Orchard.WarmupStarter.Starter
1.OnBeginRequest(HttpApplication application) +285
Orchard.Web.MvcApplication.Application_BeginRequest() +15

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +192
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +108
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +56
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Coordinator
Oct 4, 2013 at 7:39 PM
Is there anywhere in the Orchard docs that provides the steps and settings needed to successfully do this so we can then FTP up to the server.
Did you try the link in my previous post?
Oct 6, 2013 at 12:19 PM
Yes - I dont need to enlist in the source and set a GIT repo, also it talks about precompiling through the CMS line. I dont need a precompiled version of the Orchard website - the published version that worked before is fine.

Using precompiled .NET site is a pain as for every simple C# edit you have to precompile the whole site and deploy it again.

Open a Visual Studio command prompt or a .NET SDK command prompt at the location of your enlistment and run build Precompiled. This will build the application into a "build" subdirectory.

It also talks about Create an App_Data folder under the IIS application's root and make sure the user that IIS is running under has write access to that directory.
again we shouldnt need to create these data folder for the Orchard.sdf.

What would be really helpfull for developers using the fulll source in VStudio is some simple numbered steps of how to publish the site locally to a folder ready for FTP to a live server.

At the moment alot of it is guess work & trial and error -e.g. what recommended settings for - Only files needed to run this application - Exclude generated debug symbols - YES/NO?

Many thanks
Coordinator
Oct 7, 2013 at 6:31 AM
Then you can deploy a non-precompiled site. Just send Orchard.Web over, but without the dlls in the bin folder of each module that are not necessary for the module to compile.

What do you mean by "we shouldnt need to create these data folder for the Orchard.sdf"?

Whether you need debug symbols depends on whether you are ever going to debug on that server. If not, then no, you don't need them.
Oct 7, 2013 at 9:13 AM
Edited Oct 7, 2013 at 9:25 AM
OK yes the plan is to deploy non-precompiled as I have in the past with previous versions of Orchard.

So I understand correctly under Orchard.Web properties - Items to deploy:

Drop down should be?: Only files needed to run this application OR All files in this project OR All files in this project folder

(I would guess only files needed option makes sense)

I will exclude debug files as going to live server.

So the checkbox for Create deployment pacakge as a zip file is for precompiled sites only?

Image
"but without the dlls in the bin folder of each module that are not necessary for the module to compile.
So if I publish locally to a folder using these settings will I need to delete the dlls from each module/bin folder?

The point below from your link about publishing sites - its seems odd we have to manually create an App_Data folder for the precomplied versions.
  1. Create an App_Data folder under the IIS application's root and make sure the user that IIS is running under has write access to that directory. If you're not sure what that user is, go to IIS Authentication for the application. If anonymous access is enabled, the user is the local IIS_USRS. Make sure the directory is empty.
Oct 7, 2013 at 9:33 AM
Edited Oct 7, 2013 at 12:30 PM
I tried publishing with above settings (but unticking create deployment package). It published successfully but when loading localhost

Server Error in '/' Application.

None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func1[Autofac.Features.OwnedInstances.Owned1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable1[Orchard.Mvc.Routes.IRouteProvider], System.Collections.Generic.IEnumerable1[Orchard.WebApi.Routes.IHttpRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable`1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.

The published folder only has App_Data, bin, Config and three files in the root - so take it "Only files needed to run this application": is a wrong setting
tried again after cleaning solution, rebuilding custom theme (in standalone solution) - disabled then re-enabled the warm up module.

Published with "All files in this project folder" - exclude debug symbols

now works ok on localhost - folder is 90mb due to all modules having bin folders that VS2010 has added