|
Actually problem is, the application using the merged dll is not able to find the resources inside merged DLLs.
Let me explain the problem with the help of a demo project.
Here is what I have done in demo project
Inside one solution, I have 4 projects.
Project 1: DLL with name A.B.C.Resources1.dll and namespace A.B.C
Project 2: DLL with name A.B.C.Resources2.dll and namespace A.B.C
Project 3: DLL with name A.B.D.Resources3.dll and namespace A.B.D
Project 4: EXE with name X.Y.Z.ResourcesTest.exe and namespace X.Y.Z .
This project has the above three projects added as references.
Each of the first three projects contains :
A. Image resource (The resources are added the way you told).
B. One form and one button added to it.
I am simply setting the image for the button inside constructor of each project, as :
Button_Name.Image = Properties.Resources.Image_Name;
The fourth project has three buttons, each for one DLL and I am calling appropriate constructor on button click event.
Now, if i use three DLLs separately : everything works fine.
If I merge three dlls with command :
ILMerge /log:A.B.C.Resources.log /t:library /copyattrs /allowdup /out:A.B.C.Resources.dll A.B.C.Resources1.dll A.B.C.Resources2.dll A.B.D.Resources3.dll
and
use the merged DLL in the 4th project : The image for button of the 2nd DLL is not visible (Resources not found).
Observations and Findings :
1. After merging, the Resource class is getting renamed by the ILMerge for the 2nd DLL. This happens because the namespace of
the first and second DLL is the same.
Ex : I saw the merged DLL inside Reflector, It shows, inside namespace A.B.C.Properties,
Class Resources for the A.B.C.Resources1.dll DLL is as it is : Resources
Class Resources for the A.B.C.Resources2.dll DLL is renamed to A.B.C.Resources23043.Resources
2. For the 3rd DLL everything works fine, as it has different namespace.
3. If I change the namespace for the 3rd DLL to A.B.C and merge the DLLs, the image for buttons of the 2nd as well as 3rd DLLs are missing.
4. If I use the different namespace for each DLL and merge them and use, everything works fine.
5. So, basically I think this is due to renaming of the Resource class in the A.B.C.Properties namespace.
Is there any way to solve this, without changing the namespaces?? Because I want all the dlls to have the same namespace.
Is there any way to stop renaming by ILMerge?
Regards
Abhishek
|
|
|
|
|
Check this article [^]. The last section shows a way to have the same Namespace with different projects.
I would keep things simple by having different namespaces. You seem to be defeating the whole point of namespaces.
|
|
|
|
|
HI,
When i compile code using .net framework anyone can see all my code by using reflection.exe
How can i block this option ??
|
|
|
|
|
Obfuscation tools usually start you off in the right process.
|
|
|
|
|
Compilation in release mode makes it hard enough to read that people can't be bothered. Obfuscation tools are a waste of time anyway. Have you considered that your code probably isn't as unique and wonderful as you first thought?
|
|
|
|
|
Wrong on all counts. Compilation in release mode in no way makes it too hard to disassemble in something like Reflector. There are even extensions which will generate a whole solution for you.
Obfuscation although limited in what it can do is the best defence people have to protect their intellectual property, at least until DRM comes in.
Regards,
Rob Philpott.
|
|
|
|
|
Debug mode compilation generally precludes some optimizations which affects the readability of the code.
To be completely frank, an obfuscator provides little to no protection against a funded attacker. If your algorithms are complex/unique enough to be protected, then protect them with patents. If someone is prepared to rip off your implementation, and ignore any IP laws in doing do, then they are going to be able to achieve this regardless of obfuscation.
I'm engaged with a client who make use of the (otherwise) excellent yFiles graph layout library. Unfortunately these people have decided to run their library through an obfuscator. Not only does this fail to hide the actual design patterns and rough algorithms used, it also makes any exception thrown an utterly meaningless "A.B in A.A.B.A".
Source code in itself has very little value if you don't have anyone capable of maintaining it. Obfuscators are around so you can reassure your PHB that FooCorp isn't going to come and walk off with all your IP. I am yet to see code which is not protected by patent which has any value worth protecting. I'd be interested in examples.
|
|
|
|
|
Mark Churchill wrote: Obfuscation tools are a waste of time anyway.
Hear hear!
|
|
|
|
|
I have a multithreaded .NET app that I would like to use a single threaded ActiveX control in. Unfortunately, this causes an exception as I would expect. However, I was wondering if there is a workaround for this?
I cannot change the app from MTAThread to STAThread since it is using sockets for communications and needs the multiple threads for comms, and the single threaded ActiveX control is Adobe's flash control (in order to play a flash movie).
So, like I said, is there a workaround for this somehow?
Thanks,
David
|
|
|
|
|
Hi,
this is what I would attempt:
create a new thread, call Thread.SetApartmentState (only once!) and only then have it access your ActiveX.
if you need multiple threads accessing the ActiveX, AFAIK you have to proxy that and let only the one thread do the work.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Perfect - that worked like a charm. Created a delegate, stuck my dialog instantiation inside of the delegate, created a thread using the delegate, and set it to STA.
Thank you very much!
|
|
|
|
|
i am writing a stored procedure for this purpose only .
"i have a table of messages , i need the data base to notify my windows service that a scheduled message would be sent now , transfering at least the message id to the windows service"
i tried to use .net Remoting for that purpose but i figured out that .net remoting namespace can't be included in such a solution .
then i tried to use sockets to open ports through the data base to the windows service that exist on the same machine that will listen for incoming data from that clr stored Procedure . i successfully made that second choice but the problem with that , when i try to invoke the send method of udp client , it gives me an exception of socket exception
tells me socket permission request had failed , how can i grant socket access to the CLR Stored Procedure
knowing i tried to configure the code access security configuration manager in the administrative tools but in vain
anyone knows how to solve that problem either that of sockets or give me a whole new solution to the above problem
would be great
thanks in advance
Human knowledge belongs to the world.
|
|
|
|
|
I would probably forget the manually socket solution you came up with and look into SQL Server Notification Service.
|
|
|
|
|
How about using MSMQ. Thus the db can send a message to the que using CLR integration in the SQL db, and the service can pick it up from there.
alex_nel
|
|
|
|
|
Depending on what information he needs to convey to the clients, that's possible. Notification services can be more appropriate and has a lighter overhead than MSMQ.
|
|
|
|
|
Im trying to reinstall net framework 2 on my vista pc,but im told that its already preinstalled,but when i try to install a software program,ie sony media manager,i get an eror saying recent net frame work 2 is most current verion and instaltion can not continue.
Is it possible to use my vista upgrade disk to repair net framework 2,or is there another way around it.
Ive already tried the "sfc" command but that brought back nothing untold.
Any help would be most welcome
|
|
|
|
|
|
hi
I want to connect to a sqlserver instance on another computer in the workgroup network.
my program is win application with c# VS.NET 2008 and SQL Server 2000.
what settings are needed for my sqlserver instance and my application?
can you help me?
H.R
|
|
|
|
|
You need to create a Login on the sql server, apply permissions to it (Server roles, User Mapping, etc) and then in your application create a connection string for that server, e.g.
string ConnectionStr = "data source=FriendsServerName;initial catalog=TheDataBase;User ID=YourLogin;Password=12345";
Using that connection string connect to your friend's sql server.
That should do the trick.
It does on SQL Server 2005 anyway.
var question = (_2b || !(_2b));
|
|
|
|
|
thanks, I did them but I could not to connect.
----------------------------------
my application: VS.NET 2008-C#
my DB: SQL Server 2000 Personal Edition
my OS: Win XP Profesional sp3
----------------------------------
I have done these steps:
1. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> Connections tab -> tick:
-allow other sql servers to connect remotely to this sql server using RPC
-enforce distributed transactions
2. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> General tab -> Network Configuration... button ->
enabling TCP/IP
3. in target sql server instance: Enterprise Manager -> server -> right click -> Properties -> Security tab -> Authentication ->
SQL Server and Windows
4. I created a New Login in target sql server instance:
Name=admin , Password=1001 , SQL Server Authentication , Database=Exam
5. my SqlConnection in application:
"Server=192.168.0.205\\MYSQLSRV; Initial Catalog=Exam; Integrated Security=False; Persist Security Info=False; User ID=admin;Password=1001";
6. I removed anti virus softwares and turned off Windows Firewall.
7. I tested both of my computers to ping to another
But yet I have an error:
an error was occured while establishing a connection to the server. when connecting to sql server 2005, this failure may be caused by the fact under the default settings sql server dose not allow remote connections.
(provider:sql network interfaces, error:26-error locating server/instance specified)
----------------------------------
can any one help me ?
H.R
|
|
|
|
|
Erm, it seems fine, except:
H.R wrote: 5. my SqlConnection in application:
"Server=192.168.0.205\\MYSQLSRV; Initial Catalog=Exam; Integrated Security=False; Persist Security Info=False; User ID=admin;Password=1001";
Well, that should be your connection string, not the actual connection, as in:
private void ConnectToDb()
{
SqlConnection sqlConn = new SqlConnection("Server=192.168.0.205\\MYSQLSRV; Initial Catalog=Exam; Integrated Security=False; Persist Security Info=False; User ID=admin;Password=1001");
sqlConn.Open();
sqlConn.Close();
}
Test it like that.
If this is how you used it, though, I honestly do not know what is wrong.
One more thing... i understand you added a login to the server instance... but DID you actually add a user to the database you want them to use?
You'll find a "Users" folder in Databases/YourDb/Security/Users
That should help. I think.
var question = (_2b || !(_2b));
|
|
|
|
|
Hi
I am making a .NET program (C#) and are using a Tab Control with 3 tabs...however, when I hover the tabs I get a flickering effect. Anyone know how to fix this? is this a bug with the control?
|
|
|
|
|
Be sure that you have double buffering for the form set to true.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Setting doublebuffered on the form did not have any effect. However, the following code did clear up this and other repaint issues easily:
protected override System.Windows.Forms.CreateParams CreateParams
{
get
{
var cp = base.CreateParams;
cp.ExStyle |= 0x2000000;
return cp;
}
}
I find it really strange that this isn't enabled by default from Microsoft since the TabControl looks like crap without it, and there are no apparent downside of using the fix above except that you get a bit more memory usage and a few more lines of code.
Please, if possible, enlighten min why Microsoft decided to drop this option as on by default? For the record; it sets the WS_EX_COMPOSITED Window property. In MSDNAA I can't find any information indicating why this is not enabled.
|
|
|
|
|
Hi,
I have a problem backtracing which .Net transaction is blocking another transaction.
I would like to find which .NET transaction is blocking another .NET transaction. I can find the locks in SQL Server 2008 and it's corresponding SQL Server transactionids, but I cannot map the .NET transactionids to them.
In the sys-tables of SQL Server 2008, I find the transactionids of the blocking transaction and the transaction that is being blocked. (eg 75288) When I retrieve the transactionid from within my .net application through 'System.Transactions.Transaction.Current.TransactionInformation.LocalIdentifier.ToString()', it's a guid. I expected the transactionid of sql server and .Net transactionid to be the same, so I could backtrace to the blocking transaction in .NET and resolve the locking problem.
Can anyone help me with this? Thanx.
Kind regards,
Webster
|
|
|
|