How to add embeded resources dynamically on CI server to csproj file if not there? - csproj

Is there a way to check if a resource (example given below) is added in a csproj file? If not, add it properly to the csproj?
<EmbeddedResource Include="Properties\some.resources" />

Related

Any idea how to add manifest.json to html head dynamiclly

I realized that, by default, the umi project does not have manifest.json. I added the file to the public folder manually. Then, after compiling the application through the umi build command, my custom file is merged with thedist folder.
But is there any way to add the meta header to the self-generated index.html file?
I have not been able to find anything in the UMI docs. My guess, I need to build a script to insert it into the file after it is fully compiled.
Anything would be helpfull.
If you are using the pro.ant.design, you can find the index.html in /src/pages/document.ejs. It is a templated version of the index page.

Re-compile config file for WPF application?

After build my solution (WPF application), the config file is created in project\bin\debug folder. Whenever a change is made to this config file, I have to re-compile/rebuild the project to pull the changes from the config file.
Is there a way to avoid re-compiling the project after making a change in config?
This somehow throws the whole purpose of config file.
If you talk about the App.config file (an XML file where you usually put appSettings, connectionStrings, etc): it is possible to modify this one without to recompile your project / solution. Just navigate to the project\bin\debug folder, there you'll find a file that is called {AssemblyName}.exe.config which you can edit (actually, this is a renamed version of the App.config file, this happens when the build process copies it to the output directory).
If you talk about XAML related files: these are by default not configurable because they get translated to BAML (Binary Application Markup Language) files that are embedded to the assembly in a default WPF project. If you change those you have to recompile.
You do not need to recompile your project. Your assumption is wrong.
if you edit OutputDir\{appname}.exe.config, then it will take effect immediatelly. However, if you rebuild your app, this config file is overwritten by app.config from your project folder

DNN custom skin and css deployment

I am new to this and trying to figure this out. I have created a internal.ascx page and a Internal.css file for my internal page for a website. If I create a new page in DNN and apply this new skin it doesnt seem to apply the CSS. I copied the both ascx and css file to the _default/Skins/ folder.
Have also tried adding in the css via the following code
<dnn:DnnCssInclude runat="server" FilePath="/Internal.css" PathNameAlias="SkinPath" />
Nothing seems to be working. Have cleared my cache and tried different machine to view the page. But the style is still not coming through.
Thanks in advance
Create a new folder in the _default/Skins/. For example, call the folder "Internal" (/Portals/_default/Skins/Internal). Copy your ascx and css skin files into there. Rename the css to "skin.css". You shouldn't need to reference it in the ascx since DNN will pick it up based on the name.
Also, the reason your CSS include statement may not have worked was because filepath "/Internal.css" was probably trying to look for it in the root of the website. I would think it would simply be "Internal.css". But you could verify in Firebug what path it generated.

eclipse include custom files (c)

Not sure how to phrase the question.
I've created a few files for my c project that I would like to use for multiple projects.
Project root: ~/workspace/myproject
Files :
~/workspace/myproject/customlib/myfile.h
~/workspace/myproject/customlib/myfile.c
I was able to move them from my eclipse (Code Composer Studio) workspace and replace them with symlinks to their new location.
Custom lib dir: ~/myfiles/customlib
This is working fine but I'd rather not use the symlinks as it becomes necessary to add those symlinks to any project where I want my customlib files. Also when copy/pasting a project in eclipse it doesn't seem to understand the symlink and creates a copy of the file rather than the symlink.
I've set up an include path to ~/myfiles/ but when I compile I get a bunch of unresolved symbol errors.
My custom files depend on files from other include paths as well. (if that might be a hint as to why things are breaking)
Is there another way I can link in these files?
I figured out how I can do what I'm looking for but can't actually post the answer for 8 hours so I'll answer it here.
I was able to add the .c files as "Linked Resources" to my project.
So in the end I had an include path to ~/myfiles and a linked resource ~/myfiles/customlib/myfile.c.
Linked Resources can be found under Project Properties -> Resource -> Linked Resources -> Linked Resources(tab)
Unfortunately, my environment, Code Composer Studio 6 on Ubuntu would not allow me to actually add a linked resource through the IDE.
As a workaround I added the linked resource directly to the .project file.
~/workspace/myproject/.project
Under the section labeled "natures" I added
<linkedResources>
<link>
<name>myfile.c</name>
<type>1</type>
<locationURI>$%7BPARENT-2-PROJECT_LOC%7D/myfiles/customlib/myfile.c</locationURI>
</link>
</linkedResources>
The "$%7BPARENT-2-PROJECT_LOC%7D" refers to ~/workspace/myproject/../../ (a.k.a. ~/). The 2 tells it how many ../'s
In case you don't get the locationURI right the first time you should be able to edit the file path from Project Properties -> Resource -> Linked Resources -> Linked Resources(tab)
You can use any defined build variables for the locationURI. Here is another way to write the location URI. PROJECT_LOC/../../myfiles/customlib/myfile.c
Since this is an eclipse project file it will be overwritten with whatever eclipse decides is the proper format for locationURI
You can place the linked resource into a folder in your project by modifying the tag. projectsubfolder/myfile.c. This will create a folder projectsubfolder under your project directory. ~/workspace/myproject/projectsubfolder
Unfortunately this isn't an optimal solution as I will need to add linkedresource entries for every source file I create in my custom lib. CCS fumbles the linked resources when doing a project copy/paste, requiring you to add the linked resources again to your copied project.
In the end it feels like a solution but it really doesn't have much benefit over symlinked files. The only one being that when I copy/paste a project I will know the project isn't using the correct files when it doesn't compile. (symlinking will make a working project with copies of the files instead of the originals)
I imagine I will need to learn about creating .lib files to make the inclusion a little more pain free.

Passing in a file path to FileReader

Using Netbeans, I am trying to pack some text file resources that are read by a FileReader into a JAR file, but since the text files aren't located in the resources folder, the JAR cannot find them. How can I tell the filereader where to look for the files? (Such as "/src/resources/maps/level1.txt" in my case.)
Currently, the text files are stored in the project folder and can be read from there using "filename.txt"
Hmm. this sounds like two questions. First, resources get packed into a JAR file and can't be read directly as files (yes, you can execute classes on "exploded" directory mode but your code shouldnt depend on this). Once you have generated a JAR file containing your classes and the resources, you can access the resource using an InputStreamReader, not a FileReader
new InputStreamReader(this.getClass().getResourceAsStream("/maps/level1.txt"));
The reason that getResourceAsStream() is on the Class object, is that sometimes resources are placed in same package as a class. Using..
this.getClass().getResourceAsStream("level1.txt")
without a / slash at the front of the path, this would try to locate this in the same package as "this" object.
When resources are in the root package, or have their own directory structure, /maps/ for example. You can call this.getClass() on any class (in the same classloader) to find the resource.

Resources