hi, am trying to load values from config file in windows service project installer but it fails to load, then i tried to load that config file using xmldom, it worked but in this way installer looks for the file in system32 directory rather than in my installation directory.
How can i do that
The application's .config file is read from the same directory as the application executing your installer - not the installer itself. So, if you use the installutil.exe, then installutil.exe.config is used from the same directory where installutil.exe is executed (not the current working directory).
You should typically not use .config files with installers for this reason - your installer class is typically contained in a DLL and executed by something else. Instead, accept command-line parameters which make it more flexible, easy to document (see the Installer.HelpText virtual property), and easy to use even with Windows Installer packages (which you can pass properties as command-line parameters.
See the Installer.Context property documentation in the .NET Framework SDK for more information and an example of how to get those properties from the installer's context.
I cant find this error in the msdn help file. Wanted to know if anyone had a clue on what it was. Arxopia-En is a DLL that compiles and has a few string resources in it. This is just a snip of the code but it is the only part of the code that uses the RM atm. Do i need to provide more info, just cant seem to figure out the meaning of this error.
Assembly generation -- Referenced assembly'Arxopia-EN'is a localized satellite assembly
namespace HammackJ.Arxopia.Engine<br />
using System;<br />
using System.Resources;<br />
using System.Reflection;<br />
using System.Text;<br />
using Arxopia;<br />
using Arxopia.Resources; //This is the namespace of the Arxopia-EN.dll<br />
publicclass Menu<br />
ResourceManager rm;<br />
public Menu()<br />
rm = new ResourceManager("Arxopia.Resources.Arxopia_En.GameStrings", Assembly.GetAssembly(typeof(Arxopia.Resources.Arxopia_En)));<br />
You can't explicitly reference satellite assemblies - Fusion does this automatically.
The satellite assemblies contain localized values (text or binary data encoded as text, typically using base64) for information in your primary assembly. So, if you create a new ResourceManager against, say, a Form derivative then a .resources embedded resource is used (if available) to find those localized resources. If the current Thread.CurrentUICulture</code. is different or you pass a specific <code>CultureInfo to something like ResourceManager.GetString or ResourceManager.GetObject, then a corresponding satellite assembly is searched for and loaded if available, otherwise the resources in your primary assembly - the neutral language resources - are used (or a culture-independent language, if available). This lookup can be avoided for neutral resources if you use the NeutralResourcesLanguageAttribute and set that to your culture-specific language which you use for the primary assembly (like I would use "en-US"). This can boost performance when using localized resource classes like the ResourceManager.
You also shouldn't name your assembly with "EN" in the name, if you did that. Make sure you read that link I gave you. Your assembly name should be something simple, like MyCompany.MyProduct or something, and includes the neutral resources. If that's "en-US", then no satallite assemblies would need to be loaded but you still don't name your primary assembly with culture identification - it's just not proper and your satallite assemblies become oddly named an confusing.
This can be very simply done using web services.
You can create web service with method for sending messages and method for geting content of chat window.
You can store messages on server in database or simply in memory or xml file.
Also creating client that uses web services is simple.
.NET Remoting over a TcpChannel would be even better, however. Using XML Web Services forces the chat clients to poll for new messages, while a .NET Remoting object that exposed events could notify - it not send - the new messages to the clients immediately.
Since Web Services uses HTTP for the transport channel, they are bound by the HTTP protocol which is stateless and one-way by nature.
You are right.
Using web services for more complex chat application isn't good way, but I think that solution with web services is good enough for simple chating application (if there are only few users). And I tought that azhar ( I'm not sure with name) wants something more simple.
Web Services really don't make things any simpler, though. Remember that if you poll for messages, the server has to keep track of messages since the last time the client polled, and the clients - even a relatively small number of them - won't poll at the same time so the message queue would have to be associated with each client or you'd have to implement some algorithm where you keep track of the number of clients connected and clear the queue after that many requests for messages. With that, you have to worry about abnormal client termination to decrement that count.
With .NET Remoting, the message just gets broadcast to the connected clients and that's it. .NET Remoting isn't nearly as hard as many think it is.
Why don't you just read it into an XmlDocument or an XmlTextReader, which will verify that it's well-formed. Using Internet Explorer - which actually uses MSXML - is totally unnecessary and very inefficient. Once you've got it into an XmlDocument, you can perform XSL transformation, XPath queries, or just navigate and modify the DOM. If you use an XmlTextReader, you could just read it in as text.
If you want to validate it against a schema - something Internet Explorer/MSXML doesn't do automatically - you can use an XmlValidatingReader.
Just see the documentation for these classes in the .NET Framework SDK for more information and examples.
forgiven4u wrote: first I have to use IE for syntax checking
That's what I'm getting at - the XML classes in the .NET Framework check for well-formedness and perform schema validation if you want. This will return you were the error is and let you fix it. You're really taking a backward approach to doing something so simple. Remember, IE isn't even the one validating your XML well-formedness (it doesn't do schema validation) - it's MSXML which IE uses.
forgiven4u wrote: the thing is that I want to know how get an output of any program that you launch within the code.
There is no universal way of doing this. Sometimes you can redirect stdout and stderr, sometimes you can use the Windows APIs to get Window text, and sometimes you must read a DOM. Every application is designed differently.
forgiven4u wrote: say that IE returned an error, can I detect that and show it to the user?
If you used the XML classes in .NET, you wouldn't have to worry about this because any invalid XML will throw an exception while loading, giving you the information to present to the user so they can fix it. Besides, if IE is visible, it will display the error.
Do you know the answer how to add/remove references for specific configuration?
I have 2 configurations in my project, "Debug" and "Release" (as usual). I also use a NUnit and other tools that help to develop stable applications. In order to use NUnit I have to add reference: "nunit.farmework" to the list of all project references.
My problem that I don't want to add the reference in the "Release" configuration, I don't want to install NUnit or even copy nunit.framework.dll to the client machine.
Do you know a way to "dynamically add/remove reference for a specific configuration?"
Could reflection help?
Thanks in advance
I don't think this is possible, and a solution I found is to create a separate DLL where I put all the unit tests. This way I ensure that I only ship release code to our customers, and that I can freely add "tool references" such as NUnit, mock libraries, etc.
IMO, Reflection would not help you because there's no way to add attributes ([Test], [ExpectedException], etc) to a class after it has been loaded.
Due to technical difficulties my previous signature, "I see dumb people" will be off until further notice. Too many people were thinking I was talking about them...
I'm trying to automate some web tasks using an AxWebBrowser in a C# application. The browser is working, and I can modify text box text, etc. The thing I can't figure out is how to "click" an anchor. This works:
IHTMLElement link = (IHTMLElement)doc2.links.item(i,0);
if ( link.innerHTML.Equals("Log Out") )
IHTMLAnchorElement a = (IHTMLAnchorElement)link;