Closed huncu16 closed 5 months ago
Hi,
Without a sample really I can only make guesses. Also unfortuately WC has no tests nor is used from other modules to verify it works on same level. However we have this Xpand.Extensions.Compiler.CodeCompiler.Compile
which is used from the ModelMapper module and has tests for .NET Core.
So your options currently are
Coffees or boost in my todo queque available at https://github.com/sponsors/apobekiaris
Ok thanks for answer, We are waiting for your solution about this, we are in aggrieved position about that we cannot update our projects framework to .Net Core. Please notify us wich coffeer type is appropriate for you.
Best wishes.
please get in contact with me 2 apostolis.bekiaris@gmail.com and provide a sample app
I checked this case and in general WorldCreator is not at all trivial to get it to comply with the latest changes in XAF architecutre. In addition to non available tests/docs for the package I have no other option as to redesign it from scratch under the Reactive.XAF. So if there are interested sponsors get in touch with me.
Tolis, hello again i've changed the method from CSharpCodeProvider.CompileAssemblyFromSource to CSharpCompilation.Emit
I put all assemblies our generated code needed and wich u add in Xpand.Extensions.Compiler.CodeCompiler.Compile method use this CSharpCompilation.Emit method. But the line we generate
public class DynamicDocumentLibraryModule: DevExpress.ExpressApp.ModuleBase{ }
gives error like below
"CS0012: The type 'Component' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ComponentModel.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'"
if code generator skip to generate DynamicDocumentLibraryModule:DevExpress.ExpressApp.ModuleBase{}
line Emit method compile it successfully but then i cannot get moduleType with code below
assembly.GetTypes().First(type => typeof(ModuleBase).IsAssignableFrom(type));
for adding it to ApplicationModulesManager
do u have an idea what am i missing?
do u have an idea what am i missing?
I bet u miss this :)
You must add a reference to assembly 'System.ComponentModel.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
I am not sure if a missleading message though, it might refer to .net6 runtime rather to this specific assembly. In any case I would first verify that the assembly dependecy is there
as far as I remember there was a parse of all dependecies on the runtime and automatically added to the dynamic assembly so in theory u should not go add dependecies manually.
But if i donโt add them CSharpCompilation gives assembly missing error.
Its very clear that it needs system.component ๐
Even i add System.Conponent and System.Component.Primitives dlls manually and nothing change.
look I am suggesting out of my mind, so I might be totally wrong cause no test no gain. Anyway these are core assemblies which points towards a .netframework version problem rather than specific assemblies
Yes i can see, so do you know anyone else using this for .net core successfull or another xpand module generating bussines class assemblies in run time with xaf blazor?
Xpand generates assmblies at runtime with the Xpand.Extensions.Compiler.CodeCompiler.Compile
extension in many places, in the RX repository at:
Search target
Xpand.Extensions.Compiler.CodeCompiler.Compile(this SyntaxTree syntaxTree, params string[] references) : MemoryStream
Found usages (3 usages found)
<Editors>\<ProgressBarViewItem>\<Xpand.XAF.Modules.ProgressBarViewItem> (1 usage found)
Xpand.XAF.Modules.ProgressBarViewItem (1 usage found)
ProgressBarViewItemModule (1 usage found)
(55: 71) using var memoryStream = CSharpSyntaxTree.ParseText(code).Compile(references);
<Model>\<ModelMapper>\<Xpand.XAF.Modules.ModelMapper.Tests> (1 usage found)
Xpand.XAF.Modules.ModelMapper.Tests (1 usage found)
ModelMapperCommonTest (1 usage found)
(71: 60) using var st= CSharpSyntaxTree.ParseText(code).Compile(typeof(object).Assembly.Location,typeof(AssemblyVersionAttribute).Assembly.Location);
<Model>\<ModelMapper>\<Xpand.XAF.Modules.ModelMapper> (1 usage found)
Xpand.XAF.Modules.ModelMapper.Services.TypeMapping (1 usage found)
TypeMappingService (1 usage found)
(40: 75) using var memoryStream = CSharpSyntaxTree.ParseText(code).Compile(references.ToArray());
ModelMapper works for .netcore. The dependecy collection is pretty similar to what I previously said (from the runtime) however is not a blazor module not that it matters and does not create Bussiness objects but rather maps any class to a model interface. You can get a lot of guidance from its codebase.
i've checked ur ModelMapper Module. And i think its DBFirst based and if i use it i must model DB at first then get it to my application. Am i wrong?
the packages generates assemblies with dependecies for .netcore you can look how we did it there and apply it to your case
Closing issue for age. Feel free to reopen it at any time.
.Thank you for your contribution.
๐ค๐๐ฒ๐๐๐ถ๐ผ๐ป Hi Tolis, When i convert our projects framework to .NetCore wich uses WorldCreator Module it doesn't compile the generated code becouse of using cSharpCodeProvider.CompileAssemblyFromSource(compilerParameters, code); code doesn't supported in .Net Core.
I've two question 1-Do you plan to fix this neartime 2-For System.Drawing.Image typed properties and also doesn't support in .Net Core for We platform. Do you advice to convert it any type for easiest way?
Thanx for answers by now. And tell a way to buy you a cup of coffe ;)