|
I'm pretty new to C#. I have downloaded the bootstrapping sample and am having trouble getting it to work. I have placed the setup.exe file and the settings.ini file in the same folder as the .msi file. Here is my modified settings.ini file.
[Bootstrap]
Msi= Hydrolog Setup.msi
'LanguageDirectory=
'ProductName= Hydrolog
'DialogText=
'CaptionText=
'ErrorCaptionText=
'FxInstallerPath= c:\
When I start setup.exe I get a MessageBox that says "To start Application Setup, click OK. To quit without installing, click Cancel." When I click on the OK button I then get another MessageBox that says incorrect command line parameters.
Am I not doing something? Can someone help me out?
|
|
|
|
|
You realize "bootstrapper" is a generic term, don't you? What bootstrapper are you talking about? If it's one on the CodeProject site, then ask in the article's message board at the bottom. Those message boards are for specific questions / comments regarding the article.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I was referring to the bootstrapper example that is on the Microsoft website. http://www.microsoft.com/downloads/details.aspx?FamilyID=bf253cfd-1efc-4fc5-ba7e-6a6f21403495&DisplayLang=en
|
|
|
|
|
Try putting the .MSI file in quotes since it includes spaces. This is common. Also, if you're set other properties you need to remove the comment character ' . There is documentation[^] that you should read.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Got it to work!! Thanks for the help. The Probelem was the name of my msi file. I changed it to one word and it worked.
|
|
|
|
|
I had to disable Task Manager in Windows XP using C# application. This can be done by writing a Registry Key under Policies in Registry. But the problem i am facing is that when i a logged in as a limited user, it so happens that the Windows XP does not allow a ristricted user to access this part of the registry. Hence i will not be able to create/modify that perticular key in the registry.
Please tell me how to sort out this probelm.
CHEERS
I.T. D.U.D.E
|
|
|
|
|
You can't. Security permissions are there for a reason. You could simply use a group policy instead to write that value rather than writing an application to do it, which is the correct way to deploy such a policy in a domain.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Hi
How can Set The Time Or Date in c#?
i can get those but i don't know how set.
Regards' Amir Jalaly
|
|
|
|
|
.NET is too high-level for things like setting the system time. You'll have to P/Invoke the native function SetSystemTime and re-define the SYSTEMTIME struct:
[DllImport("kernel32.dll")]
private static extern bool SetSystemTime(ref SystemTime time);
[StructLayout(LayoutKind.Sequential)]
private struct SystemTime{
[MarshalAs(UnmanagedType.U2)] public short Year;
[MarshalAs(UnmanagedType.U2)] public short Month;
[MarshalAs(UnmanagedType.U2)] public short DayOfWeek;
[MarshalAs(UnmanagedType.U2)] public short Day;
[MarshalAs(UnmanagedType.U2)] public short Hour;
[MarshalAs(UnmanagedType.U2)] public short Minute;
[MarshalAs(UnmanagedType.U2)] public short Second;
[MarshalAs(UnmanagedType.U2)] public short Milliseconds;
} Fill-in an instance of the SystemTime struct and call SetSystemTime(ref obj), where obj is the instance of your struct.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I need to detach and then re-attach my MSDE db from within my C# application.
Can someone give me a clue on how to do this? I have no problem doing it in Querey Analyzer but can't seem to make the transition into C3?
Thanks,
cb
|
|
|
|
|
Connect to the master database and simply execute the sp_attach_db stored proc on the database (using all three parameters, using paths local to the target machine - not yours!) like so:
SqlConnection conn = new SqlConnect(
"Integrated Security=SSPI;Data Source=DBSRV1;Initial Catalog=master");
SqlCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sp_attach_db";
cmd.Parameters.Add("@dbname", SqlDbType.NVarChar, 128).Value = "MyDB";
cmd.Parameters.Add("@filename1", SqlDbType.NVarChar, 260).Value =
@"C:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDB.mdf";
cmd.Parameters.Add("@filename2", SqlDbType.NVarChar, 260).VAlue =
@"C:\Program Files\Microsoft SQL Server\MSSQL\Data\MyDB.ldf";
try
{
conn.Open();
cmd.ExecuteNonQuery();
}
finally
{
conn.Close();
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks Heath,
I'm getting an "Unrecognized escape sequence" for the values for filename1 and filename2.
Doesn't like the '\'.
I tried putting the value in paren's but that didn't help either.
cb
|
|
|
|
|
betterc wrote:
I'm getting an "Unrecognized escape sequence" for the values for filename1 and filename2.
Doesn't like the '\'.
You'll need to use \\ rather than a single \
Michael
CP Blog [^]
|
|
|
|
|
Thanks I figured it out (@"\bla\bla\bla");
|
|
|
|
|
Either escape them using "\" (so "\\") or use the literal string identifier "@" before the string, like "@C:\Program Files...". Looking at the documentation for the compiler error would've told you that.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello gurus,
I would like to know how can I retrieve the IPv6 address of the current computer in C#? IPv6 is activated under Windows Server 2003 and I activated it under Windows XP.
In my application, I would like to use IPv6 instead of IPv4. Is it an advantage that new application are ready for IPv6?
Thanks for your help.
Best regards.
There is no spoon.
|
|
|
|
|
What happens when you run this?
<br />
using System.Net;<br />
<br />
<br />
IPHostEntry hostEntry = Dns.GetHostByName(Dns.GetHostName());<br />
IPAddress[] addresses = hostEntry.AddressList;<br />
for(int x = 0; x < addresses.Length; x++) {<br />
Console.WriteLine(addresses[x]);<br />
}<br />
Regards,
Jeff Varszegi
EEEP! An Extensible Expression Evaluation Package
|
|
|
|
|
I have the following:
"::1 192.168.0.110 192.168.204.1 192.168.74.1"
which does not seem to be an IPv6 address.
There is no spoon.
|
|
|
|
|
::1 (with scope ID 0) is the local hosts's IPv6 address.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath!
I'm working on the multi-player mode of my game. I want to use IPv6.
::1 is the scope. okay. but how can I get the physical address of the host? like for IPv4? I have IPv6 enabled on .NET 1.1.
According to Gary Brewer's article (http://www.codeproject.com/csharp/ipv6.asp) an IPv6 address looks like this:
"xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx"
his article shows how to use IPv6 wiht .NET 1.1 sockets but it does not shows how to handle addresses.
When I do ipconfig /all with IPv6 activated, I can read my IPv6 address. I would like to do display the IPv6 address of the host.
Thanks for the help.
There is no spoon.
|
|
|
|
|
Man, you really should learn about IPv6 addresses before you start digging into them. ::1 is the interface address. 0 would be the scope. Try running my little sample code on your machine.
Also, "::" in an IPv6 address masks out consecutive zeros, so it doesn't always include 8 32-bit integers.
The point is, you don't need to worry about all this. Use something like I did in my sample app and just use one of the interfaces returned in the IPHostEntry.AddressList property. It doesn't matter which one you use, they will all work. If all it returns is IPv6 (which won't be happening for several years at least), then you'd connect to that one. The .NET classes you'd be using really don't care which you use in many cases.
The ability of an app to use IPv6 is just the ability to recognize and connect using IPv6 addresses, but it doesn't mean that an app must use it. Use whatever address is return, whether it's the 1st address in the list or the last. It doesn't really matter.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
First, you must make sure you compile against (or run against, although you won't be able to (easily) support IPv6 in the latter case) the .NET Framework v1.1.
Take this simple example:
using System;
using System.Net;
using System.Net.Sockets;
public class IPAddresses
{
static void Main(string[] args)
{
string name = Environment.MachineName;
if (args.Length > 0)
name = args[0];
IPHostEntry host = Dns.GetHostByName(name);
foreach (IPAddress address in host.AddressList)
{
Console.WriteLine("{0,15}: {1}", address.AddressFamily, address);
if (address.AddressFamily == AddressFamily.InterNetworkV6)
Console.WriteLine(" ScopeID: {0}", address.ScopeId);
}
}
} You can simply get the IPHostEntry using the Dns class and enumerate the IPAddress es.
Having your .NET application support IPv6 really isn't an issue. .NET already supports this - all you have to do is leverage it, such as allowing for IPv6 formatted addresses or checking for IPv6 support and trying to connect using IPv6.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Using your sample, I have "InterNetworkV6: ::1" for the address.
How can someone connect to a server that uses IPv6 addresses?
if a user type "::1" as server address I guess it won't work?
There is no spoon.
|
|
|
|
|
As I said before, you're forgetting about the scope ID. 0::1 is your local host address, which, IIRC, can be written as ::1 (I can't remember if a beginning 0 is necessary to specify).
Again, you really should read about IPv6. The best place is probably http://www.ipv6.org[^], which contains links to other resources.
Microsoft MVP, Visual C#
My Articles
|
|
|
|