I want to convert wpf form into dll file using vbc. this form is having only one button and nothing else.
command is as follow:
Vbc /t:library /r:PresentationCore.dll,WindowsBase.dll,PresentationFramework.dll Window1.xaml
but it give me error as:
D:\satish\iEducation\pEducation\WpfApplication1\WpfApplication1\Window1.xaml(1)
: error BC30636: '>' expected.
VulpesPosted Mar 19, 2011, 9:52 AM
But can't you change the name to whatever you want when you create the WPF application to start with?
satish jangidPosted Mar 19, 2011, 2:33 AM
I worked according to suggestion but that dll file name is created with Project name. And i want my each window will convert into dll in separate file with its name.
Any suggestion!
VulpesPosted Mar 18, 2011, 3:31 PM
Personally, I doubt whether it's even worthwhile as I can't see MS dropping WF for some years to come and, if they do, you'll still be able to maintain your application by keeping an 'old' version of VS. Even WPF isn't immune from being replaced by something else - possibly HTML5 based.
Incidentally, although it's not immediately obvious, you can create a WPF dll using VS or even VB Express. Just start a new WPF application, right click on the project in Solution Explorer and select Properties. On the Application tab, you can then set Application Type to WPF Class Library and proceed from there using XAML and code behind in the usual way.
satish jangidPosted Mar 18, 2011, 12:03 PM
I cannot do this because i have windows form more than 500 of one application and i have converted all form into dll because of some reason. same thing i will have to apply for WPF Form.
Anyway, is any other best option to take advantage of wpf to solve my problem
Help me!
VulpesPosted Mar 18, 2011, 6:02 AM
satish jangidPosted Mar 18, 2011, 5:43 AM
windows form application.
First File>
Imports System.Windows.Forms
Module iEducation
Public Sub main()
Application.Run(New STD_Frm_SplashScreen())
End Sub
End Module
Seconde File>
Public Class STD_Frm_SplashScreen
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
'Required by the Windows Form Designer
Private components As System.ComponentModel.
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Me.components = New System.ComponentModel.
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.BackColor = System.Drawing.Color.
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans
Serif", 8.25!, System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.
Me.Label1.ForeColor =
System.Drawing.Color.FromArgb(
CType(CType(64, Byte), Integer), CType(CType(64, Byte), Integer))
Me.Label1.Location = New System.Drawing.Point(12, 375)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(99, 13)
Me.Label1.TabIndex = 11
Me.Label1.Text = "iSetGet Solution"
'
'
'STD_Frm_SplashScreen
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.SystemColors.
Me.ClientSize = New System.Drawing.Size(638, 397)
Me.ControlBox = False
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label3)
Me.FormBorderStyle = System.Windows.Forms.
Me.Name = "STD_Frm_SplashScreen"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.
Me.Text = "Status4"
Me.TransparencyKey = System.Drawing.Color.
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Private Sub STD_Frm_SplashScreen_Load(
ByVal e As System.EventArgs) Handles Me.Load
With Me
.FormBorderStyle = FormBorderStyle.None
End With
End Sub
End Class
Command line
1>vbc /t:winexe /r:STD_Frm_SplashScreen.dll,
/imports:System.diagnostics iEducation.vb
2>resgen STD_Frm_SplashScreen.resx STD_Frm_SplashScreen.resources
Vbc /t:library /imports:system.drawing,
/res:STD_Frm_SplashScreen.
++++++++++++++++++++++++++++++
Now i want to convert it into wpf application to take 3D advantage.
You suggest me how to go about it.
Help me!
VulpesPosted Mar 17, 2011, 12:50 PM
When you create a WPF application from VS, the XAML is turned into VB code and then compiled together with the 'code behind' file into a single application. Worse still, some stuff is added which you don't see in VS.
To compile it from the command line, you have to write the entire WPF application in VB and to do that you'll need to come out of VS and use a text editor such as Notepad.
I've just written the following in Notepad and saved it as window1.vb
Imports System
Imports System.Windows
Imports System.Windows.Controls
Class MyApp : Inherits Application
Shared Sub Main()
Dim app As New MyApp()
AddHandler app.StartUp, AddressOf app.AppStartup
app.Run()
End Sub
Sub AppStartUp(ByVal sender As Object, ByVal e As StartupEventArgs)
Dim window1 As New Window1()
window1.Title = "Satish's WPF App"
window1.Show()
End Sub
End Class
Public Class Window1 : Inherits Window
Friend WithEvents btnHello As Button
Public Sub New()
btnHello = new Button()
btnHello.Content = "Click me!"
btnHello.Width = 100
btnHello.Height = 25
Me.Content = btnHello
End Sub
Private Sub btnHello_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles btnHello.Click
MessageBox.Show("Hello from Satish")
End Sub
End Class
I then compiled it with the line:
vbc /t:winexe /r:PresentationCore.dll,WindowsBase.dll,PresentationFramework.dll window1.vb
and it ran fine.
To make a dll, I think you'll need to remove the MyApp class and then compile the remainder with /t:library.
However, you're going to be mad within a week trying to create WPF apps from the command line. I'd stick with VS :)
satish jangidPosted Mar 17, 2011, 11:30 AM
now i got the answer as:
Vbc /t:library /r:PresentationCore.dll,WindowsBase.dll,PresentationFramework.dll Window1.xaml.vb
but i add the button that time it give me following error as:
D:\satish\iEducation\pEducation\WpfApplication1\WpfApplication1\Window1.xaml.vb(8) : error BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.W
indows.RoutedEventArgs) Handles Button1.Click
I think i will have to link Window.xaml file anyhow?
If you know this, please help me.
VulpesPosted Mar 17, 2011, 9:23 AM