I've made a hello world module for orchard following this tutorial http://docs.orchardproject.net/Documentation/Building-a-hello-world-module
I've opened up the csproj in VS2012 and changed the projecttype guids to be MVC https://stackoverflow.com/a/12811015/828859
When I build the module in MVC orchard uses the published DLL.
When i attempt to go to the /helloworld route i get 404 resource cannot be found
When i save a file and let the dynamic compilation in orchard do it's thing it works fine.
I would like to be able to deploy with a DLL so does anyone have any ideas on the problem?
Ok, two things.
First - you won't be able to deploy your module as a single DLL. There are lots of things that do not get compiled into the DLL, eg. the Module.txt manifest. It has to be there under /Modules/<YourModuleName> (as well as module's .csproj file, .cshtml files and some more). Otherwise, Orchard won't be able to find your module.
So the source code for the module has to be there, although if you build it and the module's DLL is in /Modules/<YourModuleName>/bin folder, dynamic compilation won't kick in.
Second - module development should be done using full source code - not with the downloaded deployment package. Please read here how to get full source code.
Related
I am trying to add some external DLLs to the Acumatica Customisation project but upon publishing it results in "System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid."
Error Image:
I already have added multiple DLLs to the Customisation. And was using the method specified here: Acumatica unable to publish the Customization Package to skip over the errors, but in this case it does not seem to be working.
The first step should be identifying which DLL is the culprit. I suggest you create an empty project and put the files in there one by one with the ignore rules. Maybe you missed to add ignore rule for one of the files.
This error happens because Acumatica attempts to parse the DLL as a .Net framework assembly. If you add non .Net assembly such as native x86/x64 compiled libraries you need to add the ignore rule so Acumatica doesn't attempt to parse it.
If the error is coming from a DLL you compiled, make sure it was compiled in Any CPU platform. This prevents any incompatibility related to 32 bit/64 bit mismatch.
I use orchard source code and want rename solution for fast switching between different projects. But when I changed solution name, and created new module via Orchard.CodeGeneration module, my solution not reloaded and I must include new module to solution explicitly (RMC to Modules folder -> Add -> Existing Project...). When I added to module .chtml files, intellisense not working correctly (dont see html helplers or Model property, etc.). If I try compile, all worked good, without errors.
If I rename solution back to "Orchard", and create module via codegen, intellisense working correctly for Razor view.
My workbench: visual studion community edition 2015 update 3.
Orchard version: 1.10.1
How i can fix this bug? Or is there another way to identify the project?
I'm using Orchard 1.6 and have a question regarding the build batch file.
When run, the script builds every module within the "Modules" directory, regardless of whether the module project is included in the VS solution.
Is there a setting somewhere so only module projects are built if the corresponding project is loaded in VS? (I'd like to prevent excluded/unloaded projects from being part of the build)
Thank you for any pointers.
Replace the script so that it builds based on the solution instead of the orchard.proj file.
The documentation (here and here) is notably lacking information on how references in modules are resolved:
References Resolution
(TODO: Explain how Orchard figures out references by looking at the "References" section of the csproj file as well as looking at additional assembly binaries dropped in each module "bin" directory)
Unfortunately, this is exactly the information that I need. I have created a custom module that has a reference to a custom-built, in-house DLL. When I try to use a class from this DLL, I get the following Exception:
Could not load type 'Custom.MyClass' from assembly 'Custom, Version=[version], Culture=[culture], PublicKeyToken=[token]'.
So, my question is thus: What does Orchard do with module references, and is there anything special I need to do to have Orchard pick up my module's references?
EDIT: Looks like some better information can be found in this blog post and its comments. However, my custom assembly already exists in src\Orchard.Web\App_Data\Dependencies, and I'm still getting the error.
EDIT2: We have a copy of the custom DLL in the lib folder, so I tried referencing that one instead (as we have another module that does so successfully), but still no change.
EDIT3:: In reference to the previous two edits, it's not copying from the lib folder to the App_Data\Dependencies folder. I just added a new DLL to the lib folder and referenced it, and it didn't appear in the Dependencies folder. I think the current Custom.dll isn't replacing the one that's there, which is why I'm getting the error I am. But why isn't Orchard copying into the Dependencies folder?
In order to have Orchard to use your custom module you need to have it on path: your_web_application_path/Modules/your_custom_module, we are using sym links to achieve that.
Then your main module (web application) should see your custom module. If you are adding new module to existing orchard app, you probably need to enable it by hand from admin panel/modules menu. For new installations you could add feature enable directive to your recipe and add dependency to main module.txt file (assuming you want your module always on).
Another trouble shooting tips:
make sure your module build path is set to bin/ folder (not some bin/debug etc.)
make sure your module is really an orchard module (have module.txt file) and is seen in admin panel/modules
make sure it is enabled, new modules are by default disabled
make sure referenced libraries are referenced from static folder I mean not from someting like bin which is clean up during rebuild
I have an existing solution (multiple projects, one MVC web project) that I'm trying to wrap into an Orchard module.
All documentation says that the web csproj should be at the root under my module directory (eg Modules/MyModule/MyWeb.csproj).
However, I have an existing solution structure where the sln file sits at the top level and each csproj file (and project content) sits in its own directory (the standard solution structure when you build a multi-project app in Visual Studio).
Is there a way I can tell my Module.txt file that the Orchard Module csproj is under MyModule/MyWeb/MyWeb.csproj? I'd prefer to not restructure the whole solution.
Thank you.
Note: As a point of clarification, it is not ~/Modules/MyModule/MyWeb.csproj but ~/Modules/MyModule/MyModule.csproj. The Folder name of the Module must match the file name of the project (before .csproj). This is enforced by the Dynamic Extension Loader, which requires ~/Module/{ModuleId}/{ModuleId}.csproj. (A similar approach is required for themes.)
The only potential way to do this is to write a custom module that follows the above that contains a custom loader. Within your module, create your own implementation of IExtensionLoader, and register it with Autofac. However, I don't know if it would work; I've never tried.
You will probably have an easier time reorganizing your solution.