Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 26th, 2004, 09:15 AM
Authorized User
 
Join Date: Dec 2003
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default ICodeCompiler and CompileAssemblyFromSource

Good morning,

I am trying to compile a DLL on the fly using ICodeCompiler. While I am
able to accomplish the task if I use a seperate code file along with
CompileAssemblyFromFile, however, when I try to embed the source code and
use CompileAssemblyFromSource, the DLL does not get created. Does anyone
have any ideas what might be causing this? BTW, no exceptions are being
thrown, it just doesn't create the DLL.

Below please find the source code:

        Public Shared Sub createTest()
            Dim sb As New System.Text.StringBuilder
            Dim provider As Microsoft.VisualBasic.VBCodeProvider
            Dim compiler As System.CodeDom.Compiler.ICodeCompiler
            Dim cp As System.CodeDom.Compiler.CompilerParameters
            Dim results As System.CodeDom.Compiler.CompilerResults

            With sb
                .Append("Namespace test")
                .Append(vbCrLf)
                .Append(" Public Class tSource")
                .Append(vbCrLf)
                .Append(" End Class")
                .Append(vbCrLf)
                .Append("End Namespace")
            End With
            cp = New System.CodeDom.Compiler.CompilerParameters
            cp.ReferencedAssemblies.Add("System.dll")
            cp.GenerateExecutable = False
            cp.GenerateInMemory = False
            cp.OutputAssembly = "D:\learnNET\bin\test.dll"

            Try
                provider = New Microsoft.VisualBasic.VBCodeProvider
                compiler = provider.CreateCompiler
                results = compiler.CompileAssemblyFromSource(cp,
sb.ToString)
                sStatus = "test.dll created successfully"
            Catch ex As Exception
                sStatus = ex.Message
            End Try
        End Sub



Dolphin Bay, Inc. -- turning visions into eReality(tm) -- West Palm Beach, FL
Website Design, Internet Strategy, Search Engine Marketing

www.DolphinBay.biz









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.