|
PaleyX wrote:
How do I find out the version number of a .NET DLL from within that DLL?
The AssemblyVersionAttribute Class[^] isn't a custom attribute. In order to get the version information (usually as a Version[^] object) you have to use the AssemblyName.Version[^] property. And if a method is supposed to retrieve the version of its own assembly you can use Assembly.GetExecutingAssembly()[^] to get the assembly and Assembly.GetName()[^] to get the AssemblyName object.
public string Version()
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
Best regards
Dennis
|
|
|
|
|
An application, written using Visual Studios 2002 .NET, everything works perfectly. Recently, I migrated all of the code into Visual Studios 2003 .NET (built a new project and imported files.)
This is a windows C# application, by the way.
On the live machines, the application is experiencing very strange behavior. For instance:
- Custom buttons not placing correctly
- Handlers being fired more than once
- Concurrency violation errors
- Objects being disposed at the wrong time
On my development machine, I'm seeing some of the issues, but not all of them. I am not getting the concurrency violation or mis-fired handlers on my development machine, but I am seeing the buttons not placed correctly and objects sometimes disposed of at the wrong time. I tried running the application on a separate development machine, and it also gave me the same behavior as my first development machine.
None of these issues occurred when the application was compiled and run using visual studios 2002 .NET. I have checked and double-checked the environments between the live and development machines, and the .NET Framework is the same version (1.1.4322) and the .exe files are identical. There are no additional dependencies other than an Access DB file.
Thanks for the help!!
DougW48
dwright@tdci.com
|
|
|
|
|
Hello,
My SQL Server registration name is TEAM01\xxx
I could not access this SQL Server via .NET Sql connection string.And I get an error message.
.NET code is like this:
---------------------------------------------------
public static string connectionString = "server=TEAM01\XXX;database=Northwind;User ID=sa;Password=mlsqlsys;";
----------------------------------------------------------
How can I rename this SQL Server registration name or how can I correct this connection string?
Please help
|
|
|
|
|
innocent73 wrote:
And I get an error message.
What does the error message say?
|
|
|
|
|
You can correct your connection string by using '\\' instead of '\' or start the string like: @"server...
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Thank you VERY VERY VERY MUCH!!!
Problem solved..
And thanks to other readers for their attentions
|
|
|
|
|
check your SQL Server Installation..
Use Mixed Mode..
|
|
|
|
|
Hi guys and girls,
What I am trying to do is find out what the user entered into the Folder option of an install.
I have a c# project with a standard installer project created with VS 2003. I would have thought there was a simple way to find out where the user choose to put the app and then use that information to create an entry in the registry to launch the app on startup.
I can create the reg entry and make it work if I use the default install path, I just need to know how to get the actual path and I can't find a way!
Any help would be great
Mike
|
|
|
|
|
Hi!
You could create a custom action to save the installation path.
When calling the custom action you can give the installation path as argument, using the [INSTALLDIR] installer variable in the call arguments.
In this case you have to be careful to get the parameter escapes right (IIRC you'll have to put a single '\' after [INSTALLDIR] if it's the last parameter).
Or you use reflection in your custom action dll to find out where it's run from and then extract the path to the assembly from that.
Surely there are several other ways to perform this task, too. Other suggestions anyone?
mav
|
|
|
|
|
Run Regmon from SysInternals when you run your install program to see where in the registry it puts the data. Then use regedit to look at the value of the registry setting on the target directory on the machine in question.
Sincerely,
-Ron
|
|
|
|
|
Cheers for your replies guys, just incase anyone else gets stuck on this I'll put what I eventually did.
Added a reg entry into either
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
Create a new string value and call it what you like. Then as the value put [TARGETDIR]App_Name.exe.
Simple when you know how so I hope others dont have to waste a day on it like I have!
|
|
|
|
|
Hello,
I just want to override the System.Exception in order to log when an exception occurrs in an XML file, for doing that I tought I sould declare a class called exception and then to do
<br />
public class Exception : System.Exception<br />
{<br />
....<br />
}<br />
but I don't know to say to code that I want to use my exception when I do
<br />
catch (Exception ex)<br />
{<br />
....<br />
}<br />
thanks
Paolo
|
|
|
|
|
You could do something like this:
namespace MyNamespace
{
public class Exception : System.Exception
{
}
public class Foo
{
public void Bar()
{
try {}
catch (MyNamespace.Exception e) {}
}
}
}
However, you really should not do it like this. Instead use a self-explanatory name for your exception class that ends with Exception (just as an example: XMLProcessingException). For details on using exceptions see Class Naming Guidelines[^], Best Practices for Handling Exceptions[^] and Using User-Defined Exceptions[^].
Best regards
Dennis
|
|
|
|
|
A few months ago I came across a post on CP that contained a programmatic break point. Basically when this line was hit in runtime whilst running an application through VS debug mode it would drop out into the debugger (exactly the same as placing a manual break point)
The problem is that, after much searching, I cant find the post/article in question. So does anybody know what it is?
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
|
Hi
How Can find the total battery remaining time ( or % ) in notebook ?
is there any dll for this work ?
Regards' Amir Jalaly
|
|
|
|
|
Amir Jalaly wrote:
How Can find the total battery remaining time (or %) in notebook? Is there any dll for this work?
This kind of function can be found in the Power Management[^] part of the Win32 API. I your case you'll have to PInvoke GetSystemPowerStatus()[^] (there is even an example on how to use it in C# on MSDN: Using Win32 and Other Libraries[^]).
Best regards
Dennis
|
|
|
|
|
This question belongs in the ASP.NET[^] forums.
|
|
|
|
|
Hi,
I need to be able to recognize excel-like cell-references (i.e. 'Sheet1'!$C4 ) and have a regular expression for that, which works just nice. However, users should be allowed to encapsulate a such field (or a plain number for the sake of simplicity) in parantheses (spellcheck..) like ((12)) as this is syntactically correct. However - there has to as many opening '(' as there is ')'. I cant just count these, as a field reference may include e.g. a '(' in the sheet-name.
So, is there any way with C# regular expressions to count and compare counts of certain characters ? The regex for the simple example could be
"[(]*[0-9\.,]*[)]*" - which would allow an un-even number of opening and closing parantheses.
Any tricks to do this ?
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
Doesn't (\([0-9\.,\]*\))* work?
|
|
|
|
|
If I'm not mistaken there is no regular expression for what you need to do because the language you descibed is not regular.
So I guess you will need to write a custom parser or use a parser generator such as this one http://www.codeproject.com/csharp/spart.asp.
--------
Dave
[Math Studio]
|
|
|
|
|
Hi
How do I add a custom MenuItem on a MainMenu,ContextMenu or Menuitem? Is there an event I can override?
I have made a collection designer property on them all, where I can add custom MenuItems, but that only works when using the property editor. What I whant is, when u have f.ex. the MainMenu activated and click on an empty menuitem field, that a custom MenuItem is added instead of the standard MenuItem.
Any hints, workarounds articles? I can't seem to find any.
TIA
-spif2001
|
|
|
|
|
Hi all,
I need some samples for licensing the windows form application.My criteria is whenever user attempting to login the application i want to check the license key which is stored in a database table. The way to generate the license is, wherever application is installed, a KEY is generated with that computers CPU number.When user is logging in, how do we check this, (i.e.) we have application running on a server 10 users who are connecting to a server, we don't have to install the license on all the clients (PC's).
This should be checked only on the server side.
We should check the license when any one connects to a server (MSSQL) (I don't want to install license on every client, it should be only on the server, here ever the MS SQL you have installed or connecting to)
Any body have idea about this type of requirement, please send me the code samples or documentation .
thanks
sastry
sastry
|
|
|
|
|
Considering most machines have their CPUID's turned off by default, and some machine don't even have them, why would you want to create a license key using this number? It's an unreliable source...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I've been playing with the new Visual Studio 2005 beta and am quite impressed with the potentials of the built-in "ClickOnce" deployment scheme.
I've deployed (err, 'published' according to VS) my company's application to a network share using Visual Studio 2005 beta. When I try to run the .application file from the network share, all goes well, until a message box pops up telling me that the application has been blocked because it 'poses a high security risk'.
My question is, is there some way to allow all the users on our corporate network to run the application without having to configure each and every machine? Isn't there some way to make ClickOnce popup a dialog saying "hey it's dangerous, but it's your data. yes/no"?
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|