|
Hello,
Assembly probing - how to instruct runtime to look under bin folder instead of GAC?
According to this article[^], runtime default behavior is to check GAC BEFORE other location.
So the fact that I added probing hint didn't change this (i.e. runtime is still binding to dll in GAC):
<br />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><br />
<probing privatePath="bin;bin\Debug;bin\Release;"/><br />
</assemblyBinding><br />
But this is NOT what I need, I actually need it to go bin folder for it?
This may be relevant.[^]
Also how can I check which version is being binded to? I launched "fuslogvw" but it is just sitting there. Nothing shows for some reason... it's giving me headache because (a) dll in GAC no debug information (even under DEBUG build)
(b) nHibernate mapping files loading - my mapping files are in bin folder, not in GAC
Thanks
dev
|
|
|
|
|
AppDomain.CurrentDomain.AssemblyLoad
and
AppDomain.CurrentDomain.AssemblyResolve
You may be able to write some code with those events to accomplish your goals.
|
|
|
|
|
sorry not exactly sure
you're saying i should implement event handlers to assembly loading/probing, set a breakpoint and see where it takes us?
I am suspecting perhaps it has to do with signing or that I've accidentally put one of System.Remoting.xxx dll into GAC (I ran a util which installed my dll's into GAC - which may have incorrectly installed System.Remoting.xxx into GAC ...)
so dead
dev
|
|
|
|
|
When the run time detects it is time to load an assembly it will call that method first allowing you to provide the assembly. You can then load whatever version you wish.
|
|
|
|
|
ah... ok...
i'm starting another test now though. Restore my monday backup and run the test cases again. If that works, it means I didn't screw up my GAC by installing any System.Remoting.XXXX there.
If no, then ...
awe... i cant think straight now all i can do is to watch test cases run after i restore backup my mind is just too fried.
dev
|
|
|
|
|
Especially on Thursdays is a long lunch :p
|
|
|
|
|
good stuff - just ran test cases against MON backup it's okay --- meaning:
(1) I lost up to MONDAY but not more
(2) My machine's GAC is *NOT* the problem
I will give my mind some rest before coming back next WED, then add back what i did last two days, bit by bit
Thanks for your advice though
dev
|
|
|
|
|
hey...
is this what you meant?
<br />
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)<br />
<br />
43: {<br />
<br />
44: Debug.WriteLine(string.Format("CurrentDomain_AssemblyResolve reports that '{0}' was unresolved.", args.Name));<br />
<br />
45: <br />
<br />
46:
<br />
47: string[] parts = args.Name.Split(',');<br />
<br />
48: if (parts.Length > 0)<br />
<br />
49: {<br />
<br />
50: Assembly assembly = Assembly.LoadFrom(string.Format(@"{0}\{1}.dll", assemblyPath, parts[0].Trim()));<br />
<br />
51: return assembly;<br />
<br />
52: }<br />
<br />
53: <br />
<br />
54: return null;<br />
<br />
55: }<br />
<br />
56: <br />
Thanks!
http://blogs.conchango.com/markmann/archive/2008/09/01/loading-and-resolving-assemblies.aspx[^]
dev
|
|
|
|
|
oh this looks like it...
<br />
Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args)<br />
{<br />
<br />
Assembly MyAssembly, objExecutingAssemblies;<br />
string strTempAssmbPath = "";<br />
<br />
objExecutingAssemblies = Assembly.GetExecutingAssembly();<br />
AssemblyName[] arrReferencedAssmbNames = objExecutingAssemblies.GetReferencedAssemblies();<br />
<br />
foreach (AssemblyName strAssmbName in arrReferencedAssmbNames)<br />
{<br />
if (strAssmbName.FullName.Substring(0, strAssmbName.FullName.IndexOf(",")) == args.Name.Substring(0, args.Name.IndexOf(",")))<br />
{<br />
<strong>strTempAssmbPath = txtAssemblyDir.Text;</strong><br />
if (strTempAssmbPath.EndsWith("\\")) strTempAssmbPath += "\\";<br />
strTempAssmbPath += args.Name.Substring(0, args.Name.IndexOf(",")) + ".dll";<br />
break;<br />
}<br />
<br />
}<br />
MyAssembly = Assembly.LoadFrom(strTempAssmbPath);<br />
<br />
return MyAssembly;<br />
}<br />
http://www.chilkatsoft.com/p/p_502.asp[^]
Thanks for your hint
dev
|
|
|
|
|
Hi,
I am developing a application in which i need to get the list of installted programs on windows server 2003, from add or remove programs. I am using C#. any idea how to do it.
Currently I am having this code:
const string INSTALLED_SOFTWARE = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
string[] softwareInstalled;
try
{
regKey = Registry.LocalMachine.OpenSubKey(INSTALLED_SOFTWARE);
softwareInstalled = regKey.GetSubKeyNames();
regKey.Close();
}
From this I am getting complete program list. But I am looking for specifically add/ remove program list.
Thanks in advance,
Priyanka
|
|
|
|
|
Hi,
Read the following article[^], I think it will help.
Kind regards,
The only programmers that are better C# programmers, are those who look like this -> |
Programm3r
My Blog: ^_^
|
|
|
|
|
Hey guys n gals
I am creating an app where there will be several 'steps' of which need to be completed before the final form is shown. Is there a way where we (I) could use one panel for each step and simply show and hide appropriate panels on the completion of a particular 'step', instead of creating a whole new form for each step?
I know how to do this but everytime I create more than one panel, the controls from one panel end up going onto the panel behind the top panel. I know a groupbox would work for this but they are ugly (atleast in this situation). I can't seem to find any info anywhere else that may suggest that there would be another way of doing this.
thank you,
jay
|
|
|
|
|
Create a UserControl for each step in the process and add/remove those from your main form.
|
|
|
|
|
Yay! Thank you Jimmanuel!
jay
|
|
|
|
|
See below, Jimanuel's suggestion is flawed to say the least.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
jt_23 wrote: Is there a way where we (I) could use one panel for each step and simply show and hide appropriate panels on the completion of a particular 'step', instead of creating a whole new form for each step?
This is the basic approach for a wizard form.
- each step is on a panel
- sitting forward/back incriments or decriment the panel to be shown.
If you place all the panels on a group control, you can have a nice and pretty method to show the correct one:
private void ShowPanel(Panel panel)
{
foreach (Control ctrl in groupBox1.Controls)
{
ctrl.Visible = (ctrl == panel);
}
}
Do not start adding and removing controls on the fly; the problems outweigh any possible benefit.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Thank you walliamnw your approach is alot easier ill try this one. thanks again!
jAy
|
|
|
|
|
If you go to the top of this page and enter wizard in the search box and change from messages to articles, you will find lots of examples to help you.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I've used sql command here is my code
string CommandText = "select * from par where Time between '" + textBox7.Text + "%' and '" + textBox13.Text + "%' and Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%'and Duration >= " + textBox10.Text + " ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
It has problem that if I haven't insert value to Time it will not show anything but
if I take the value to it I can run the search and It'll take the value to mydatagrid
|
|
|
|
|
What do you want it to do? ie. when no time or date is entered.
You don't have any validation here at all do you? That's a concern. They could type anything into those textboxes. Wrong input could throw an exception and malicious input could wreck your database. I'd consider parameterising your query rather than string building it.
Regards,
Rob Philpott.
|
|
|
|
|
I want to search it but if I didn't insert value in textBox7 or textBox13 it will not show anything( but I 've inserted data in another textbox)
string CommandText = "select * from par where Time between '" + textBox7.Text + "%' and '" + textBox13.Text + "%' and Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%'and Duration <= " + textBox10.Text + " ;";
but if i insert data into it it will show like this command
It's mean that every function is subset of between right ?????
|
|
|
|
|
That's what it's supposed to do.
I suggest using DateTimePickers rather than TextBoxes, and parameterize the query.
|
|
|
|
|
Actully I've get the code but it 's too longgg
private void button4_Click(object sender, EventArgs e)
{
sql_con = new SQLiteConnection("Data Source= " + info + ".db;Version=3;New=False;Compress=True;");
sql_con.Open();
sql_cmd = sql_con.CreateCommand();
if ((radioButton1.Checked == true))
{
if (textBox10.Text != "")
{
if (textBox7.Text != "")
{
string CommandText = "select * from par where Time between '" + textBox7.Text + "%' and '" + textBox13.Text + "%' and Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%'and Duration >= " + textBox10.Text + " ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
else
{
string CommandText = "select * from par where Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%'and Duration >= " + textBox10.Text + " ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
}
else
{
if (textBox7.Text != "")
{
string CommandText = "select * from par where Time between '" + textBox7.Text + "%' and '" + textBox13.Text + "%' and Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%' ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
else
{
string CommandText = "select * from par where Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%' ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
}
}
else if ((radioButton2.Checked == true))
{
if (textBox10.Text != "")
{
if (textBox7.Text != "")
{
string CommandText = "select * from par where Time between '" + textBox7.Text + "%' and '" + textBox13.Text + "%' and Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%'and Duration <= " + textBox10.Text + " ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
else
{
string CommandText = "select * from par where Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%'and Duration <= " + textBox10.Text + " ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
}
else
{
if (textBox7.Text != "")
{
string CommandText = "select * from par where Time between '" + textBox7.Text + "%' and '" + textBox13.Text + "%' and Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%' ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
else
{
string CommandText = "select * from par where Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%' ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
}
}
else
{
if (textBox7.Text != "")
{
string CommandText = "select * from par where Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%' and Time between '" + textBox7.Text + "%' and '" + textBox13.Text + "%' ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
else
{
string CommandText = "select * from par where Date like '" + textBox6.Text + "%' and Linein like'" + textBox8.Text + "%' and Lineout like '" + textBox9.Text + "%' ;";
DB = new SQLiteDataAdapter(CommandText, sql_con);
DS.Reset();
DB.Fill(DS);
DT = DS.Tables[0];
dataGridView1.DataSource = DT;
int rowCount = ((DataTable)this.dataGridView1.DataSource).Rows.Count;
textBox12.Text = rowCount.ToString();
sql_con.Close();
MessageBox.Show("OK");
}
}
}
|
|
|
|
|
I want to develop a pdf printer. I can pass any type of document to the pdfprinter so that it will generate the PDF file.
i have used the Ghostscript 8.56 and my Operating System is :XP.
1.I can get the Postscript file (.ps)
2. Unable to convert to .pdf
I don't know where i did mistake, my code is as follows :
string command = "gswin32c.exe -q -dNOPAUSE -dBATCH - sDEVICE=pdfwrite -sOutputFile=" + path + " -fd:\\GSOUTPUT.PS";
Process pdfprocess = new Process();
StreamWriter write;
StreamReader read;
ProcessStartInfo info = new ProcessStartInfo("command");
info.WorkingDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
info.CreateNoWindow = false;
info.UseShellExecute = false;
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
pdfprocess.StartInfo = info;
pdfprocess.Start();
write = pdfprocess.StandardInput;
read = pdfprocess.StandardOutput;
write.AutoFlush = true;
write.WriteLine(command);
write.Close();
ret = read.ReadToEnd();
Pls help me to create pdf....
Thanks in Advance.
Regards
Doni
|
|
|
|
|
Hello all
I am using WebMethod and File.Move
But my problem is the file is being locked by the WebMethod and it cannot be moved again (I want to rename it, not move it)
The exception thrown is "The process cannot access the file because it is being used by a another process"
How do I solve this?
I probably googled for half an hour
Here is my code:
[WebMethod]
public void EditFile(string FilePath, string NewName, string OldName)
{
File.Move(FilePath + OldName, FilePath + NewName);
}
|
|
|
|