Upload files from external library? - phpstorm

I've added my cms as an external library in PhpStorm:
I just wanted to know if there is an option to upload (deploy) these files too? I always have to switch to my cms and open it itself as a project to be able to upload its files.
I've found nothing in the documentation also.

If it's not part of the project root/outside of the project -- then no.
But you can make it part of the project by:
adding it as Additional Content Root (Settings/Preferences | Directories) -- it will be listed as additional node in the Project View panel (similar to actual project's main folder)
or just symlink it (e.g. a subfolder inside the project root that is symlink to outside folder).
Please note that in both cases such folder becomes part of the project so the search routine will take those files into consideration as well as other functionalities (find usages; look for errors in a code; TODO's etc.). You may also accidentally edit your CMS core files and IDE will not tell you anything (in case of External Library it will notify you about this).

Related

Visual Studio Successfully Using Shared Project wwwroot Files on Publish but not on Build/Run

The Background
I'm working in Visual Studio 2019. I have a C# Web APP Razor Pages project which references several C# Class Projects and one C# Shared Project for files common across several other related Web App projects.
The Problem
When I publish the web app project to my local or a remote IIS instance, no problem, the shared project files, all of them, are present and accounted for and work as expected.
However, when I "just" build/run then view it in the browser, the shared project Helper and Pages are as expected, but the shared project wwwroot files are all missing in action.
The Want
I could, but do not wish to have to, publish locally every single time I need to see / troubleshoot anything that's in the shared project, so ...
I would like to find a way for the shared project wwwroot folder assets to be useable on Build/Run -AND- to be able to do it in such as way as to not to adversely impact the Publish process in which it is currently working as expected.
The Deets
The example folder structure for the relevant projects (probably tmi but detailed enough that if I have to do soemthing with paths from one project to the other, these relative paths would be correct enough for an example to be made) ...
inetpub
wwwroot
MyNameSoftware
wwwroot <-- all wwwroot files from both web app and shared projects end up here on Publish, yay
MyName
MyName.Common.Domain
MyName.Common.Domain.csproj file
various folders and sub-folders with classes
MyName.Common.Presentation.Web
MyName.Common.Presentation.Web.shproj file
Helpers <-- works fine
Pages <-- works fine
wwwroot <--- these files are available on Publish but NOT on Build/Run
aContainerFolder
other irrelevant stuff and things
MyName.Software
MyName.Software.sln
Various other MyName.Software.{Purpose} folders for related projects included in solution
MyName.Software.Web
various other folders and sub-folders
wwwroot <-- these files are available as expected on both Build/Run and Publish
MyName.Software.Web.csproj file
Where to go from here
As I was laying out what I'd tried and the questions I had, some things fell into place. Love the process, hate the pre-process hair-pulling. So I've answered my own question here, but will go ahead and post this so I can refer back to it later and so maybe it will help someone else keep a few hairs. Also, if there are other ways to do this, bring 'em on -- always good to consider alternatives. :0)
After research and putting bits and pieces together...
... the following is working for me on Build/Run and on Publish (be it via right-click-project-select-publish or via command line msbuild w/ deploy on build).
(1) store files destined for wwwroot in another folder, say, _wwwroot, and adjust the project files so they don't get published directly:
web app project's .csproj:
<ItemGroup>
<Content Remove="_wwwroot\**\*" />
</ItemGroup>
shared project's .projitems (note the absence here of CopyToPublishDirectory or CopyToOutputDirectory tags):
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)_wwwroot\**\*" />
</ItemGroup>
(2) add build events to the web app project
a pre-build event to remove everything in the web app project's wwwroot folder (so each build starts with a clean slate)
rd /s /q "$(ProjectDir)wwwroot"
and 2 post-build events in each web app project
xcopy /E /Y /I "$(ProjectDir)_wwwroot" "$(ProjectDir)wwwroot"
xcopy /E /Y /I "$(ProjectDir)..\..\..\MyName.Common.Presentation.Web\_wwwroot" "$(ProjectDir)wwwroot"
(3) set each web app project's wwwroot to be ignored on check-in to source control since the _wwwroot folders will be checked-in and will be considered the source of record
(4) reference everything that will be in the wwwroot folder normally, just as if they are always there since they will be present in wwwroot when needed

Where is the site.css file located for Identity?

I have an asp.net core 2.1 MVC application. I have ran the Scaffold Identity which has generated all the HTML and models used. I can't however find the css file that identity is using for its layouts?
In chrome developer tools it tells me site.css is being loaded from /Identity/css/site.css and bootstrap is being loaded from /Identity/lib/bootstrap/dist/css/bootstrap.css. These files don't seem to exist anywhere in my project. Am I missing something?
It's not using the site.css file that's located in wwwroot/css.
The Identity default UI is a Razor Class Library. The static resources are being embedded and loaded from the library. Specifically, the Static Files middleware is loading up the embedded resources as if they were on the filesystem, using a ManifestEmbeddedFileProvider.
Long and short, you can override those by simply creating files in the same location in your project. Then, your project's versions will take over. Unfortunately, the scaffold doesn't provide a way to scaffold static resources as well. However, you can simply view the source in your browser and then copy that into your project's version of the file.
You can also view the source of the RCL here. That way you can reference whatever code you need, without even needing the scaffold. Anything you add to your own project overrides what's coming from the RCL.

How does Windows link HTML files to folders?

Almost every time you save a web page from a web browser to your local computer a PAGENAME.html (or .htm) file is created and a folder named 'PAGENAME_files' that contains resources specific to that page.
If you copy/move/delete either the folder or the .html file Windows automatically does the same operation the other file as well.
This behaviour also happens if you create a file named 1.html and a folder called 1_files.
How does this link happen? And why does it work only with web files?
This is a shell feature, not a file system feature. The shell copy engine just looks for a folder with the same name (plus a localized suffix) when copying/moving .htm[l] files.
This feature is called Connected Files and is documented here.
It's a built-in linkage in Windows.
Open up Explorer (not IE, Windows), Tools, Options, View, then in Advanced Settings there'll be a "Managing pairs of Web pages and folders" section.
If people are stuck and ended up here to find how to unlink, here's an easy trick : on Windows 10, I couldn't find how to unlink a .html file from its associated media folder, so I deleted both of them, and in the bin I restored only the .html file and it was then restored and unlinked from its folder.
It is a good question.
Under Windows 7 I managed to solve forced links by simply renaming the file.
I think it is the easiest way.

How do I configure a Web Application project for working with html pages without .Net code?

We have a few html pages in one of our solutions that are meant to be extremely simple, client side only, pure html+javascript pages that access our web api. The api itself is in a web application project in the same solution.
We are now using a web site project to contain those files, but it is getting harder and harder to manage that project, since it's information is placed on the solution, and most of it's aspects cannot be controlled like they can on a msbuild project file.
I'd like to migrate those html files to a web application project, but I'm struggling to make it as basic as possible. For instance, I do not want to generate any dlls on the project. It should be in the solution just to provide access to the files and to enable us to control what goes to the _PublishedWebsites folder on the build by setting the build action on the files. We need this because there are some miscellaneous files in the project that should not be published.
I tried creating an empty web application and removing most things from it, by editing the csproj file. I managed to delete all references and the whole Properties special folder (along with the AssemblyInfo.cs file), but when I run the build command, I still see a dll created along with the obj and bin folders. Then, I tried faking the build target on the csproj file, like this:
<Target Name="Build" />
Now when the project is built, no dll/pdb is created, but the obj and bin folders are still there. Next, I tried setting the outputpath property to the current directory, like this:
<OutputPath>.</OutputPath>
But even then, the obj folder is still created.
EDIT:
I just found another common msbuild property that controls where the files inside the obj folder are placed. After placing this in my csproj file:
<IntermediateOutputPath>.</IntermediateOutputPath>
I now get no folders generated on build, which is nice.
There is a small problem now though (and I'm not sure how and where exactly this process happens) when I open the solution or reload the project in Visual Studio. Even though the project is not being built at this time, some files are still generated:
I feel the current approach is enough for my requirements, yet I'd really like to know if there is a more elegant way to achieve that. Thus, the question holds: Is there a way to make the web application project work as if there was no code file in it, effectively disabling output generation (bin and obj folders, and the dll/xml/pdb outputs)?

threepenny-gui - opening files

Dear Haskell community I have written my first gui application and decided to use
threepenny-gui to do so.
The task is the following search the files in a given folder for matches and provide links to open those files. In addition I made nice parse and render function as the files (mostly) have a special formatting.
But now I have stumbled upon a problem - most browsers prohibit links to local files by href="file://localhost/home/user/folder/file.pdf" being opened, for security reasons, which I do understand and find completely sensible.
I tried to use href="./file.pdf" when the program and the file are in the same folder, which also doesn't seem to work.
The code of the whole application is available at github/epsilonhalbe, I run it in a folder and access it via a browser at localhost:100000
The HTTP server provided by threepenny-gui will serve up static content from the directory you specify in tpStatic. Put your files in that directory, and make your links' paths be relative to it, and you'll be good to go!
As of threepenny-gui-0.4.*, there are also two functions loadFile and loadDirectory that can be used to serve a local file or directory at an automatically generated URL. This can be useful if the tpStatic field is not enough.