Use DLL file in my URL link , c# - c#

I'm writing a c# code to do :
1- get file file zipped folder.
2- add file to zipped folder.
3- if the file is Image then do compression and re-size the image with some conditions.
and its working perfectly :)
i need to put the code inside a library and build it so i can get a DLL file, and that's easy too i have no problem with it.
the problem is: how can i pass parameter to that DLL file. i need to use it like this:
<a href='myDLL.dll?image=XX&width=XX&height=XX&compression=XX' />
please help me on this.

I think it is not possible to call a dll from html, why you didn't use a HttpHandler for this?

In order to create a dll file which can be usable by other project, you should create a new "Class Library" project. This is a specific type of a project which returns only a .dll file as a result. Then you should add this dll to your other projects in order to use the functions.
Here is more info about the topic:
MSDN Class Library

Related

How to add External .exe to my C# project?

Can I add external .exe to my C# project so that i don't need any path to access it as outside app?
I want to embed it as my project resource?
Thanks in advance
You can add file by right-clicking on the project, or drag-n-drop works.
You can add your exe in your solution and set its Build Action: Content and Copy to output Directory: Copy always.
The installer should automatically include the file.
Hope this helps

How to combine many CS files into a DLL file?

Basically what I'm trying to do is this:
1: Take an existing DLL file.
2: Edit some C# scripts inside. I'm doing this by using DotPeek to open in Visual Studio.
3: After editing the files, put them back into the original DLL file so the program works fine (modified by me).
So now I'm stuck on the last step, getting the files back into the DLL file so the program works. Any ideas? THANK YOU.
Extract all the source files from the dll, assemble a .csproj, and build it the same way as any other dll. That's the way I've done it. I'm sure there's some way to squirt individual types into the dll, but depending on the complexity of the dll, my method might be easiest (or completely impractical)

Can I compile a single aspx.cs file into a DLL?

I'm attempting to make a single small update to a website written in C#/ASP.NET.
All I'm trying to do is change the email address a form submits to, which is why I'm not seeking out a proper C#/ASP.NET developer.
I've done a little research, and it seems that the site itself is using dll files in the /bin folder to run the forms and things. The form is contact.aspx.f3293f9sd.dll, so I've edited the corresponding contact.aspx.cs file.
What do I do now?
Can I build this single CS file into a single DLL and upload it? I've scoured the menus and see no such option, and Google results seems to imply that you need to add entire projects and build entire projects at once.
Is that correct? What's the process here?
What you need to do is open the solution file. Solution files are files composed of projects. The contact.aspx.cs file is part of one of those projects. You need to make your change in the file, then recompile your solution. Then you can upload the DLL file it outputs to your production. Make sure you compile in Release mode.

Add a file to project resources using C#

I'm creating SpecFlow tests for an application that uses an xml settings file (example, C:\ssis\mySettingsFile.xml) to run. In one test, I want to save the file to disk, and then add that file to my project resources and clean up the disk location. Then, another test will unpack the resource to a temporary directory and use it from there.
I'm clear about the unpacking part, but is there a way to programatically pack the file into a project resource rather than manually adding it to the project using the VS GUI and marking it as an embedded resource?
I know this is wrong, but I'm thinking something along the lines of:
string myPath = "C:\ssis\mySettingsFile.xml";
TestHelper.ResourceDirectory = "$\...\...\Project.Folder.Resources";
myResource = TestHelper.PackResource(myPath);
myResource.IsEmbeddedResource = true;
...where PackResource method saves the file to the project resources.
Thanks in advance!
you can create a Resource Folder and add your xml to it.
When you click on Properties of the project, there will be a Resources tab wherein you can see your file.
To access the file, you can use ProjectNamespace.Properties.Resources.yourfilename.

Integrating a .exe file into a visual studio project

broken to bare-bones scene:
I have a program in c# that calls a .exe inside cmd(using process.start), passing some required arguments.
What i'm trying to do: Include the exe into the project so that i don't have to call cmd.
Any idea?
If you just want to include so you don't have to ship two files then just include it into the project as "embedded resource" (see project item options) and then you can call ResourceManager.GetStream and write it to file and call Process.Start.
If you want integrate the functions of that exe so that the exe is not needed anymore (no Process.Start) then you need the source code...
EDIT:
the "write to file" is not necessary if the exe is .NET - then you can directly load it from the resource stream as Assembly/AppDomin and execute it.
You can add an exe as an embedded resource (just right click on a folder in the Solution explorer, Add Existing Item, then get properties on it and set it to be Embedded Resource). However, you may not be able to easily execute it in place - you'll need to save it to disk and then execute it (which doesn't solve your stated problem of having to ShellExecute the .exe file, but does solve the problem of having to ship more than one file to the end user).
If you have the source code, then you'll be able to repackage the exe as a dll, or integrate it directly into your program code.
If the exe is a .NET assembly, you could use ILMerge to merge the exe into your main assembly. You can then invoke the code in the exe directly.

Categories