I have .txt file which I want some parts of its content to be different for debug and release build.
{Bunch of text. debug and release...}
#if DEBUG
{My texts onlyfor debug build}
#else
{And texts onlyfor release}
#endif
{Other bunch of texts...}
Is such thing possible?
You could generate your .txt file when your application starts based on your example using #if DEBUG statements.
You could even include your two files as myFile.txt.debug and myFile.txt.release and then copy the right one to myFile.txt when the application starts. These could be included as content files or in your projects resources.
For XML and JSON files you can use https://github.com/microsoft/slow-cheetah to generate file based on your build configuration.
Related
How can I generate a file during "Build" in Visual Studio using C#?
I want to create a .txt File and add some text in it. The file should be created directly when I press Build and save it in a place where the Release or Debug Folder is.
You should have a look at build events.
Typically you can run any kind of script pre and post build - including the (re)generation of a text file.
To copy files into the output path, you can use the OutputPath variable. See the MACRO section and this list on how to use them.
As by #Oliver's comment: if it is a static file, you can just include it in the project using its properties and select: Copy if newer.
Taken from the documentation:
And a subset of the MACROs
I am working on an Xamarin.iOS application that is crashing when being deployed via an Ad-hoc process. As documented by Apple, when an application crashes, a .crash file is generated. The document also states that, as a developer, we must keep the dSYM folder.
Turns out, in my case, I (only?) have a mSYM folder.
Question
What is the difference between an MyApplicationName.App.dSYM folder and a MyApplicationName.App.mSYM folder?
.dSYM
A dSYM file is a "debug symbols file". It is generated when the "Strip Debug Symbols" setting is enabled in the build settings of your project.
When this setting is enabled, symbol names of your objects are removed from the resulting compiled binary (one of the many countermeasures to try and prevent would be hackers/crackers from reverse engineering your code, amongst other optimisations for binary size, etc.).
dSYM files will likely change each time your app is compiled (probably every single time due to date stamping), and have nothing to do with the project settings.
.mSYM
mSYM means MonoSymbolArchive.It contains debug info of mono.
Edit the iPhone release configuration in the csproj file to include <MonoSymbolArchive>True</MonoSymbolArchive> which will generate symbol data in bin/iPhone/Release/.mSYM
I have a folder in my main project that is separate than the Resources folder but also has some resources it that I would like to copy to the output folder as I reference it throughout the app.
I have set the build action to Resource, content, embedded content.. tried them all..
Also set it to always copy to output directory.
Now, from within my application I'm entering
AppDomain.CurrentDomain.BaseDirectory + "Dashboard\\Role.xml";
or also
"..\\..\\Dashboard\\Role.xml";
for the path and get an exception that says that the file can not be found.
Both of these paths work in my development machine but not once I deploy through click once.
I have tried to add it to the application files in the publish section as suggested in another post but it does not appear there.
I have also tried to put it in the resources folder and still nothing.... any ideas?
I followed some steps in this link and got it working:
https://msdn.microsoft.com/en-us/library/kzy0fky2.aspx
Basically, you mark the file as build action "Content" and set it to always copy.
Then, you go to the application files in the publish section of your clickonce application and they will now show up.
Switch them from datafile to "Include" and you're set!
I use NSIS to create an installer for my project. Wishing to have as small a filesize as I can, I began looking into my project's dlls, included files and prerequesites and noticed the following are all different:
the minimal files required to run, as determined by educated guess + trial and error. I made sure the application works properly with this minmal set of files.
the files exported by the "Publish" fonction for click once deployment (excluding click once specific files)
the files in the release directory (excluding the pdb and vshost files)
It seems VS2015 generates an xml file for every dll. Some dlls I don't use and don't reference are copied as well.
My question is why is there so many unnecessary files and how can I configure VS2015 to not have them in /release?
If you set VS build log level to verbose you will see exactly what happends during build and why a file goes to release folder. Once you determine the reason, you may either change your project file to adjust predefined behavior or add post-build event to remove unwanted files produced by build process.
MSBuild file, located at "C:\Program Files (x86)\MSBuild\12.0\Bin\Microsoft.Common.targets" is very useful to dig into build process details as well.
However, if you indend to distribute the content of release folder to other machines I'd suggest you look at some installation software, like Wix, for example. Once you create a setup project which includes files you do want, there will be no need to fight for release folder content.
I've switched over my solution's Build configuration to Release mode and now have an output in the "Release" folder instead of in the "Debug" one.
But still the Release output contains Program Debug Database files. Why is that? When should I keep them, when and how should I get rid of them?
The debug database files (.pdb or "symbol files") contain debug information, such as line numbers, to enable easier debugging.
When present, exception stack traces will contain the actual source file full path and line number.
It is up to you whether to distribute these along with your application.
In order to not create pdb files in Release configuration:
Go to your project's Properties.
Under "Build" tab, select "Advanced" (on the buttom).
For "Debug Info", select "None".
Note that this will not affect any references assemblies (their .pdb files will be copied to your project's output folder.
Read more about Symbols here: Program Database Files (C#, F#, and Visual Basic)
I guess it would be no difference if you deploy your application without these program debug databases as these files could be of great size.