I have a resources file name "Index.en-US.resx", initially it was "embedded resources" build action and it worked well in localization.
But when it is "embedded resources", it compiled it into .dll file.
In my case, users are able to modify the content of .resx file from time to time.
It cannot be .dll file after published.
Is there anyway to read the .resx file as "content" (since it will not be compiled into .dll) ?
If you don't want your .resx file to be compiled into dll after published, I think you can put it in your wwwroot, Because wwwroot is where static files are stored, the project will not compile it as a dll, As follow. You can see the resource file is not be compiled in dll after published.
Related
If I include a .bin.gz file in a DLL as an embedded resource, it doesn't show up in the Assembly.GetManifestResourceNames() list, and cannot be loaded with Assembly.GetManifestResourceStream(). If I rename the same file to anything else, it does show up.
The .bin.gz file shows up in .csproj. I'm building a .NET Core 2.2 class library.
What's going on? Is there some kind of filter by file type that prevents certain types from being embedded?
EDIT: On further inspection. It appears that the .bin.gz resources are placed in a different .dll named [AssemblyName].resources.dll, which is placed in a "bin" folder next to the [AssemblyName].dll. Why is this and why does this not happen with other files?
I am very new to C# and I have read several posts about using configuration files. I have perhaps a very basic question I have been unable to find an answer to. I created a Config folder inside my project to put some path information for input/output files. There also seems to be a Config folder inside the \bin\debug\folder. My App.config file points to Config\appSettings.config. I can't figure out which Config folder is getting used in my project. Is it the Config folder I created or is it the Config folder inside the \bin\debug\ folder? Thanks in advance for any help and I hope I followed all the rules for posting a question.
I think that it's potentially both files.
Whenever you build your application, the compiled .exe, .dll and .config files are copied or written to the \bin\debug folder. The application is then run from the \bin\debug folder. The App.config file in your project directory gets automatically transformed into a file called ProjectName.exe.config which is what the ConfigurationManager class looks for.
If you use configSource in your App.config file to reference another configuration file such as Config\appSettings.config then this will also need to be copied to your \bin\debug folder so that it can be can be accessed when your program is run.
I have a compiled c# assembly that I am registering for COM exposure. In order to import my library into some legacy c++ code the .tlb file needs to be in one of my "include" directories.
Instead of adding my bin directory to the include directories of the project that will use it, and since these projects will always be compiled under the same folder structure, I was wondering if, on compile, it was possible to direct my .tlb file to a specific directory.
In the Project Properties under the Build Events there is a Post-build events section. Here you can apply any command you'd like, including copy.
Here's some example code that will copy a file form the bin\Debug directory to another directory in the C:\ drive.
copy "$(TargetDir)\filename.tlb" "C:\output directory path\"
Use XCOPY in a post-build task.
I added 3 html files to my project and the change is reflected in my csproj file.
But to deploy this on to a web server, is it enough if I drop these 3 files in the appropriate directory? Or is there any build/assembly deploy needed because of csproj change?
Html files do not require build, just copy the files
IF you have code behind for aspx files then you need to deploy the dll.
Add the file to your project.
Set the build action to "content".
Set "copy to output directory" to "copy always".
The file should be included in the same folder as the rest of your deployment. You should be able to see it by building it and looking in the \bin\release or the \bin\debug folder. If it's not there, click on the Application Files button and see if it shows up there.
Deploying the HTML files to your web server simply requires you copy the HTML files to the appropriate directory.
The resulting change in your .csproj was really only made to keep track of the files within your IDE but no, you wouldn't need to rebuild/redeploy the resulting DLL just for static files.
I kept getting errors in my log file that messageconfig file not found. It turned out that my application was expecting it in the bin\debug folder. What causes the application to expect so? It seems that when project is built it should copy the config file in bin\debug folder. Am i missing a certain project setting?
App/web.Config files are expected to be in the same directory as the application/web root.
Other, referenced config files may be in other directories, as specified in the main configuration file.
If you right click on the .config file, then on properties there is a Copy to Ouput Directory entry.
This should be set to either Copy if Newer or Copy always, if this is set to Do not copy, the .config will not by copied to the debug/release folder where it is expected.
Config files are expected to be in the same location as the executing assembly.
Check out this SO question:
.NET 2.0 Application Settings (user.config) file location
You could set the files build action to "Copy always"..
usually you only need the .exe. Try to clean and rebuild your project..
Hope it helps