Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi everybody,

i create a Dll file and i use it c# project.However in c# project my dll class can editable but i dont want o someone edit my dll file.How can i fix?
Posted
Updated 9-Feb-16 2:05am
v2
Comments
PIEBALDconsult 9-Feb-16 8:08am    
"i change some line in dll files"
That makes no sense. Do you actually mean the code? Or the DLL that results from compiling it?
Even the DLL _can_ be edited in certain ways and there's nothing you can do about it. Don't spend your time worrying about such things.
Sergey Alexandrovich Kryukov 9-Feb-16 10:05am    
Exactly. This short comment is better than all three answers I can see right now, because first thing is first — the inquirer does not understand the basics of programming, what compilation does, what's on input and output, forget life cycle. This needs learning.
—SA

.NET DLL files are Assemblies - and that means they aren't "editable". They are readable (and always will be, even if you obfuscate the content to make it harder) because the system needs to be able to read them in order to execute the code they contain.
But they aren't "editable" in any useful sense - there is no "Assembly editor" which allows me to make changes directly to your DLL. That doesn't mean I can't edit them using a hex editor, if I know exactly what I'm doing - but they can't be changed in in teh sense of altering your code as C# and the DLL "magically" reflects that. In order for teh DLL to change, it would need to be recompiled.

So if you are "changing lines in DLL files" then that implies that you have added the DLL Project to your solution - which is fine, and allowed because you often want to develop the EXE and one or more DLL Assemblies at the same time. But it's not the only way. Backup first, then remove the Project from the Solution, and the references from the other projects. Then create a new Solution, and include the DLL Assembly as its Project. Build that for Release.
Go back to your original Solution, and add a Reference to the newly created DLL in it's Release folder using the Browse button.

Now your app will build, and will be able to use the DLL content, but it won't be able to change it.
 
Share this answer
 
If you don't want someone to edit your cs file then don't give them access to it. cs files are designed to be editable so if you have people you don't want developing you need to implement some kind of code repository like SVN or GIT that has relevant access controls.
 
Share this answer
 
A DLL can't be (easily) edited. You probably included the source project into your solution and that's why you can edit the source of it. If you (or someone else) just add that DLL as a reference to a project then it's not editable.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900