I am creating a Symfony Bundle where I have my commands, entities and all the logic that I need.
But in one of my commands I need to store files in /web/bundles/mybundle/images.
I've been googling a lot and I can't find anyway to get my bundle web root directory from a command.
Is there any Symfony function to get my bundle web root directory?
There is nothing in the Symfony2 core which will give you directly the path of your web directory...
One possible solution:
$path = realpath($this->container->getParameter('kernel.root_dir').'/../web');
Related
I'm using Fluent Migrator 1.6.2 in my .Net application.
For migrating up or migrating down the database, Migrate.exe needs to be executed by passing assembly file (the dll file of the database project in which the migration classes exist) from the command line.
And by default, Migrate.exe file gets created inside \packages\FluentMigrator.1.6.2\tools folder.
I want both these files (Migrate.exe and DbProject.dll) to be created inside the same folder.
Is there any configuration setting in fluent migrator by which I can control the location at which Migrate.exe file gets created and create it inside my DB project?
No such configuration exists. You however, can set a specific folder in your solution, where you copy the Migrate.exe file and other needed files, then set the properties of your Migrations project, to build to said folder, resulting in binaries generation every time you build the application.
Recommendation here is to have the migrations in their stand alone project inside your solution.
It's time to learn ASP.NET Core, so I create test project. When I learn project structure I found then folder for static files (wwwroot) marked as ignored.
StaticFiles package was added as well as UseStaticFiles method was called on Configure. Why this happend? How should I fix tis?
Once you will add static files inside the folder, it will no longer be ignored by your Source Control Manager.
I have an ASP.NET MVC project that serves static files form its root.
I see that these files are marked as Content and Do not copy.
Nevertheless, when I hit run in VS the static files are served from the root of the project.
I would really like to gather some static resources in a different project, and have them served as well.
I tried to create a class library and reference it from the main project, but files marked as Content in the class library is not deployed when I hit F5.
Is it possible to serve static files from a different project? If so, how?
The simplest way to accomplish this is to to add a Post Build Event to your ASP.NET MVC project
Add an xcopy command to "WebApplication1 Properties -> Build Events -> Post-build event command line"
More information: Copy file(s) from one project to another using post build event...VS2010
Unfortunately this won't handle deletes or renames very well.
I have a question about flyway migration folder . Does sql's have to reside in project folder Application/foo/bar/main/resources/db/migration. Could it reside outside of the application cource folder?
We are using Maven.
By default Flyway will look for migrations on the classpath under db/migration, which on a Maven project means src/main/resources/db/migration.
You can however also use a location starting with the filesystem: prefix that can be anywhere on your disk.
See the ”Location and discovery“ section of the SQL-based migrations documentation page.
For command-line use, see the locations option on the migrate command reference page.
We have an installer for a website of ours which works great, I exclude the web.config and a few other files when creating the installer. However I can't seem to exclude a folder. Is this possible?
I've created the installer using the .NET built in Web Setup Project found in the visual studio group Other project types > Setup and Deployment within the new project dialog. This only has the option of including groups of output and excluding files via the filter.
What technology are you using to generate your installer?
Edit after additional info in the question: OK, I haven't worked with the built in Web Setup Project, but I did use a regular setup project once. You control the output of each project that's included in the setup by setting the Build Action property of each content file. Set it to None to exclude a file.
There isn't a Build Action property for a folder, so you'll have to set it for all the files within a folder. If a folder doesn't have any content files, then it shouldn't be included in your setup project.
The only way I found to exclude entire folders and any files within sub-directories was to modify the deployment project which fed into my Installer. Check out the following for information removing folders pre-build:
http://www.meadow.se/wordpress/?p=137
And this for post-build:
http://blogs.msdn.com/webdevtools/archive/2008/10/05/exclude-files-and-folders-from-wdp-output.aspx