MSBuild: Capture command line properties in preprocessed file - properties

Using MSBuild 4.0 (framework version v4.0.30319), I pass properties to MSBuild when calling a project file thus:
MSBuild Build.csproj /p:Property1=Value1
Is it possible to use the /pp (preprocess file) option to capture this in the generated file?
The reason I ask is that we have around 20 properties already set within an imported project file ... out of which we will normally override less than 10. The first time the Build project is run, the properties to override are passed via command line (by a batch file). The properties will (naturally) not have the modified values if the project is launched in the IDE. I tried placing them in an msbuild.rsp file adjacent to the project, and those do come into effect when MSBuild is invoked. But I want them to persist in an imported project file such that the IDE also knows the updated values. The imported file is dispensable and therefore I was trying to have the values persist inside it.
Thanks in advance for any pointers.

Related

How to set a filename for file templates in IntelliJ

I am trying to create a new file template in IntelliJ for a specific type of file needed by the framework I am using. The name of this file is always going to be base.kt, and I have added the file template as per this:
This works fine for me other than the fact that everytime I right-click on a module and say 'New base.kt', it still asks me to enter a filename. For the package-info file template that comes pre-shipped with IntelliJ, it just creates the file without prompting this dialog:
Is there a way for me to make IntelliJ always use a particular name and skip this dialog?
You just need to write #set($NAME="base")

Having trouble with program arguments and Intellij

I'm trying to run some scripts from a Coursera class. The scripts do work if I manually input the data and terminate via ctrl-d. But no matter what format I give to program arguments or place the text file, IntelliJ ignores the argument. It doesn't seem to be at all trying to access the file - I would have expected at least an error if something was wrong in the argument box but the app just runs waiting for input.
I've tried....
1) Placing the file in an "input" folder and setting the program argument to be...
./input/tinyUF.txt
2) I'm pretty sure I tried every possible folder location for the file within the path project and then using the argument...
tinyUF.txt
and "< tinyUF.txt"
3) I tried the full Windows path as the argument as well.
Nothing helps or seems to actually make IntelliJ do anything. Anyone know what I might not be doing correctly?
This feature is not supported in IntelliJ Idea yet. You can find issue here.
Remove the path from program arguments and enable check mark (Redirect input from) option in a configuration and add the file path including file name in it.
PS - I have tried it in IDEA 2019.2 (Community edition).

Embedding an image as a resource in a FireBreath plugin

While using VS (2010), I used to be able to add an image as a resource simply by going to the Resource view and then: Right click project > Add > Resource > Import.
I even asked a question about how to then load it: Loading an image from a resource embedded in a dll, but that changed for some reason.
Now when I try the same thing and save the .rc file, I get this message:
"The resource script FILE_PATH.rc was not created using Microsoft
Visual Studio. Comments, macros, preprocessor directives, and
conditionally included information may be modified and/or removed from
this file during the build process. Replace existing file?"
Even if I click "yes" (in order to just test things) then I get all kind of error messages at compile time:
ResourceCompile:
gen\firebreathWin.rc(8): error RC2144: PRIMARY
LANGUAGE ID not a number
gen\firebreathWin.rc(16): error RC2135: file not found VS_VERSION_INFO
etc...
I have two questions:
What is the correct way to add an image resource which will be added to the compiled plugin using CMake? I searched about it and couldn't find any helping information.
What can be the cause for this change in behavior? since I was able to use the same exact steps before and it worked.
Thanks.
First of all, I wouldn't do this; instead, I'd just put the file in the same directory as your DLL and use the path of DLL to find it.
That said, the "correct" way to do this would be to see what changes are made to the .rc file when you add it in the IDE, copy the .rc file from gen_templates/ in the root of the firebreath directory into your project, and then make those changes to your copy of the file. Any changes you make to the generated file will be overridden any time cmake is run again, which can happen any time your cmake files (CMakeLists.txt, *.cmake) change.

adding extra files to vb.net project

I am trying to add some 'supporting' files to my project in VB.NET Express 2012. These files are additional files that are not really part of VB.NET such as RTF files which are templates for reports etc. There is also some text based template files, that will get modified as part of the execution of my program.
What I have done:
I have added these to the project (i.e. they appear in the Solution
Explorer under the project)
I have set the 'Copy to Output Directory' of each of the files to
"Copy Always" in the properties window.
When I publish the project and re-install it, none of these files are included.
Any help would be appreciated. Thanks in advance.
From build action you should select "content"

VS2010 Projects with Common Files

I have a vb.net project that has 2 exe's that get built as well as the installer. The two exe's share a bunch of common files. I do not want to have two copies of the common files or mess around with having build events that copy things around (if possible).
My method was to create two projects in the same folder and have them point to the files they needed. This appeared to work until I tried to compile both apps at which point I get an error in a file called Application.Designer.vb. It seems that project files create this file in their folder and when I have two solutions in the same folder they conflict.
So my next effort was to create the second project in it's own folder and just add the items as needed. The problem here is that VS2010 doesn't hold a link to a file in a different folder it copies the file to the new project folder.
What is the vs2010 way to get this done?
You were almost there when you created your second project. Rather than adding the files to the second project, you need to link them.
When you add them, VS copies the source file to the current project's directory.
When you link a file, it leaves it in its current location and just adds a reference to the file to your project. This means that you are operating with a single source file instead of multiple copies.
To link a file, choose Add Existing Item... menu item from the Project menu, select the file(s) that you want to link, and then click the dropdown arrow next to the Add button on the file dialog and select Add As Link.
We have class files that are shared this way among a half-dozen projects, including Win Forms, Silverlight, ASP.Net, Services, and PocketPC.
The easiest solution would be to shove all the common stuff into a common project, and simply reference that project from your other two solutions.
Solution A:
Project A
Project C
Solution B:
Project B
Project C
Just my recommendation anyway.