Update resource files in assemblie - c#

the website i'm working on has resource files for a number of languages.
The resources of the website are compiled in the website dll (i think?) and the resources from other, from the website, referenced dll's, are stored in subfolders of the \bin directory.
So i have in the bin my website.dll, and a subfolder called es with the Spanish resources for the website.services project (called website.services.resources.dll) and so on.
Now we have the site live, and there is a wish for a immediate change of one of the items in a resource file.
As my .resx files are compiled, i have to change the resource in the dll.
Is that possible?

Just change the specified item in the rsex file. Compile it again and replace the DLL. I think it will work.

another approach could be to copy up your project to the server, in it's entirety. Then the runtime on the server will compile the app for you. Then when you next make a change to the resx file the runtime will re-compile the app and pickup the change.
Downside to this when you make a change to the resx your users may notice the site stop working and may lose any session variables (if i remember correctly).

Related

How to access files in dll

Good time of day. There is a folder with files in the dll project. How to access these files from the dll class, if not to make them resources (so as not to know in advance the number of these files - otherwise you need to use reflection)?

Place WinSCP.exe in project resources for WinSCP .NET assembly

I'm using WinSCPnet.dll in my project and to run correctly it needs WinSCP.exe in launch directory e.g. project_path/obj/Debug. But if I want to use my program, it needs to have this .exe file all the time in same folder otherwise the program will crash.
Is it possible to place WinSCP.exe into project resources so I don't have to place it in same directory everytime I move it?
(Sorry for my clunky English, don't downvote me for that :/ If you need some additional info I'll gladly post it)
The winscp.exe has to exist as a real file, at the moment you call the Session.Open.
So while you can store the winscp.exe to your application resources, you have to extract it somewhere (e.g. to a temporary folder), and set the Session.ExecutablePath accordingly, before you call the Session.Open.
Inspired by your question, I have added instructions for Embedding WinSCP executable as resource to the assembly documentation.

How to copy built assemblies into a project resource folder?

In the Resources folder of my project, I have many different DLLs from other assemblies in my solution. These DLLs are used as embedded resources so I can have a single EXE without having to have local copies of all the DLLs. What I want to be able to do is have them updated every time I build my entire solution. So for example, if I have AssemblyOne/bin/x86/Debug/Foo.dll, I want the DLL to always copy over to LocalAssembly/Resources/Foo.dll whenever I build the project.
Is there an easy way to do this? I was looking at the post-build-event macros, but none of them would be able to directly reference my "LocalAssembly", which is not the Solution Directory. Also, I'm not sure how I would go about writing a new custom post-build command in a way that the newly copied DLLs would not be an absolute reference to my local machine. Thanks! Please comment for more information and I will edit the question.
You need not access only your solution folder in post build events. The post build scripts run with whatever permissions the compiler had when it ran. Since in Visual Studio things frequently run with Administrator permissions, chances are great you have access to your entire file system. As a result, if you are wanting to copy resources around, you merely need to presume that you are starting the xcopy call in the build destination directory. From there, you can navigate around with normal paths. So if, for example, you needed go up three levels and then into the directory LocalAssemblies, your copy command would look like xcopy Foo.dll ../../../LocalAssemblies.

Website compilation process[AppCode DLLs]

We are working on a website project which contains around 1130 pages. After compilation, all the .aspx.cs files are converted into AppCode DLLs that has random names.
Whenever there are any changes in single .aspx.cs file[like a hotfix], we have to recompile and deploy the entire project on the application host.
We want to update only those files that have been changed and not the entire package.
One of a solution we are aware is that, converting Website to Web application; but we cannot implement that change at this stage of the project.
Is there any other way to find an efficient solution for this?
Yup. Talking in Visual Studio 2010:
While publishing the website, Select the option: 'Use Fixed naming and single page assemblies', Also select 'Allow this precompiled site to be updateable'.
After website is published. Go to the published folder. Open any aspx page (not the dll or .cs).. Note the dll name in page attribute under inherits attribute. Than using ftp or any other way to upload, copy or upload tht dll under bin to your website.
Also, you can create a doc or txt file to list all Dll names with respective paths to your file to easily know which dll to upload next time if there is any change.
Hope it helps.

Compiling folders into Executable

Maybe not possible but I have an application that gets text from a bunch of text files organised in folders which are all included in my project. However I'd love to compile these text files into the exe so that I don't have to lug the folders with the application. Anyway I can do this?
The folders are in a hierarchy i.e. each folder has a txt file and image that my application uses. At the moment they are all set to build as Embedded Resources which I thought would have compiled them in but unfortunately not.
Preferably I love if there was a way I could add the folder rather than each file individually.
"Compilation" means something else.
Anyway, .NET confusingly uses the same terms to describe "embedded resources", which are exposed as resource streams from the assembly, and the more API-friendly resx resources which are then compiled into .resources files that are also stored as embedded resource streams.
If you want to use ResX resources in your project then go Add New Item > Resources (resx), then go to the Files tab and add references to your filesystem files, then build your project. You'll be able to access those files by going typing FooResources.MyFileName in your program's code, assuming you named your resx file FooResources.

Categories