Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. CompileAssemblyFromSource

CompileAssemblyFromSource

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelpwinformsquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    izotov
    wrote on last edited by
    #1

    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)

    M 1 Reply Last reply
    0
    • I izotov

      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)

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      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 1 Reply Last reply
      0
      • M minhpc_bk

        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 Offline
        I Offline
        izotov
        wrote on last edited by
        #3

        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)

        M 1 Reply Last reply
        0
        • I izotov

          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)

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          Is your sample source code simple enough? Have you got the error when trying that method with the source code such as a very simple class?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups