CompileAssemblyFromSource
-
Hi I have a class which makes runtime compilation. When I use it in a WinForms application it works fine but when I use it in an ASP.NET Page I allways get a "Could not find file" error. Here is a sample: Dim CParams As New CompilerParameters() Dim CProvider As New Microsoft.VisualBasic.VBCodeProvider() With CParams .GenerateExecutable = False .GenerateInMemory = True .IncludeDebugInformation = False .TreatWarningsAsErrors = False End With Results = CProvider.CreateCompiler.CompileAssemblyFromSource(CParams, Source) (Source contains the source code of the assembly to create) When calling lobjCProvider.CreateCompiler.CompileAssemblyFromSource I get >>Could not find file "C:\DOCUME~1\KARESZ\ASPNET~1.KAR\LOCALS~1\Temp\svzrojnc.dll"<<. "C:\DOCUME~1\KARESZ\ASPNET~1.KAR\LOCALS~1\Temp" is the temporary folder for ASPNET user account. Is this a permission problem? I tried to grant Everyone Full controll on this folder but still not work. Thanks! (K)
-
Hi I have a class which makes runtime compilation. When I use it in a WinForms application it works fine but when I use it in an ASP.NET Page I allways get a "Could not find file" error. Here is a sample: Dim CParams As New CompilerParameters() Dim CProvider As New Microsoft.VisualBasic.VBCodeProvider() With CParams .GenerateExecutable = False .GenerateInMemory = True .IncludeDebugInformation = False .TreatWarningsAsErrors = False End With Results = CProvider.CreateCompiler.CompileAssemblyFromSource(CParams, Source) (Source contains the source code of the assembly to create) When calling lobjCProvider.CreateCompiler.CompileAssemblyFromSource I get >>Could not find file "C:\DOCUME~1\KARESZ\ASPNET~1.KAR\LOCALS~1\Temp\svzrojnc.dll"<<. "C:\DOCUME~1\KARESZ\ASPNET~1.KAR\LOCALS~1\Temp" is the temporary folder for ASPNET user account. Is this a permission problem? I tried to grant Everyone Full controll on this folder but still not work. Thanks! (K)
-
Hi there, IMHO, that's not a permission problem. Does your source code have any reference to an external assembly? Since it seems to me that the compiler could not find the file while compiling. Are you sure that this method causes the error?
I am sure becouse when I get to this line while debugging: Results = CProvider.CreateCompiler.CompileAssemblyFromSource(CParams, Source) I examine CParams.OutputAssembly property, and it is the same as the name of the assembly not found. For example when I get >>Could not find file "C:\DOCUME~1\KARESZ\ASPNET~1.KAR\LOCALS~1\Temp\svzrojnc.dll"<< CParams.OutputAssembly value is "C:\DOCUME~1\KARESZ\ASPNET~1.KAR\LOCALS~1\Temp\svzrojnc.dll" as well. So I think the framework cannot create that file for some reason. Any other ideas? (K)
-
I am sure becouse when I get to this line while debugging: Results = CProvider.CreateCompiler.CompileAssemblyFromSource(CParams, Source) I examine CParams.OutputAssembly property, and it is the same as the name of the assembly not found. For example when I get >>Could not find file "C:\DOCUME~1\KARESZ\ASPNET~1.KAR\LOCALS~1\Temp\svzrojnc.dll"<< CParams.OutputAssembly value is "C:\DOCUME~1\KARESZ\ASPNET~1.KAR\LOCALS~1\Temp\svzrojnc.dll" as well. So I think the framework cannot create that file for some reason. Any other ideas? (K)