Do you know if there is a way in Magento to override classes from Zend framework using configuration like in next example:
<config>
<global>
<models>
<mymodule>
<class>MyNamespace_MyModule_Model</class>
</mymodule>
<zend>
<rewrite>
<somezendclass>MyNamespace_MyModule_Model_SomeZendClass</somezendclass>
</rewrite>
</zend>
</models>
</global>
</config>
I don't think it is possible.
If you really want to change some class from ZF, you should copy it to app/code/local/Zend (path to your class...) directory.
Bad thing is that you should copy and paste whole class.
Related
With classic .Net projects, if I added a reference to a NuGet package, it would get downloaded to a packages folder and I could check that into source control along with the rest of my code. This allowed any developer to download the code, along with the NuGet packages, without having to set up a package source to separately download the packages. This is not how .Net Core projects work. There does not seem to be a packages folder for the solution, and it is up to each developer to set up the custom package source and download the packages when they get the code. Is there a way to configure the .Net Core project to do like the classic .Net projects did and manage a packages folder?
A lot of NuGet behaviour can be controlled via NuGet.Config files (See this reference for more details)
If you place a NuGet.Config file next to the solution with the following content, you can override the location that the packages will be restored into:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value=".\packages" />
</config>
</configuration>
If the problem is that you'd need to set up additional sources in VS on every machine, you can also add those sources via a NuGet.Config in your repository so VS will pick up the feeds to use when opening a solution:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="CompanyFeed" value="https://my.company.com/private/nuget" />
</packageSources>
</configuration>
If you have no feed to host packages and need to include packages with the solution, you can use a directory containing .nupkg files as well in NuGet.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="local" value=".\NuGetPackages" />
</packageSources>
</configuration>
I want to install a design time plugin for a visual studio extension (ie runs when using visual studio, and not when the application is running). This requires that I modify the app.config with an entry that points at the dll containing the extension code. The plugin is installed via nuget and if I add this dll to a folder under the project and use a fixed path in the app.config.install.xdt then everything work ok. However what I want is for the xdt to insert a value which points to the dll in the packages folder, where it gets installed via nuget. My problem is that the relative path to the nuget folder is not fixed for the projects. Each project may be in a different folder (several folders deep inside the solution folder) and not just in a direct child of the solution folder, so I want to be able to use some variable in my xdt.
Currently I have this in my xdt:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<specFlow>
<plugins xdt:Transform="InsertIfMissing">
<add name="NCrunch.Generator" path=".\SpecflowPlugins\" type="Generator" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)"/>
</plugins>
</specFlow>
</configuration>
but I want something like this:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<specFlow>
<plugins xdt:Transform="InsertIfMissing">
<add name="NCrunch.Generator" path="$(SolutionDir)\packages\Specflow.Ncrunch.1.0.0\lib\net" type="Generator" xdt:Transform="InsertIfMissing" xdt:Locator="Match(name)"/>
</plugins>
</specFlow>
</configuration>
is this possible in xdt? if not is there another option for getting this to munge the app.config correctly when my nuget package installs?
The XDT syntax doesn't allow replacement tokens such as the one you put in your example.
One option I can think of would be to modify the app.config.install.xdt file in your init.ps1 PowerShell script, replacing the tokens for the actual values before the XDT transform is applied by NuGet.
For more information regarding init.ps1 see: Creating and Publishing a Package
I have a situation where I want to set the repositoryPath variable of the NuGet.config file to a location relative to the current user's machine. The goal is to have a location where all of the NuGet packages get placed, so that:
They are not located in the solution folder for each of our team projects (ie. /Solution/packages/*)
They are shared across many projects, so that only one copy of that package needs to be installed on the machine.
Ideally, I would like to use a path with an environment variable, such as %APPDATA%, however the NuGet Package Manager doesn't work with this.
My config file looks something like this:
<config>
<add key="repositoryPath" value="C:\External\NuGetPackages" />
<add key="DefaultPushSource" value="\\SourceCode\NuGetPackages\" />
</config>
Where ideally I would like the repositoryPath to work like this:
<add key="repositoryPath" value="%APPDATA%\External\NuGetPackages" />
Things I have tried:
$(APPDATA)
$APPDATA
$Env:APPDATA
The first two of these just result in directories with those names being placed in the same location as the NuGet.config file.
This has been added as a feature in NuGet v3.4+
Variables can now be added in Windows using the standard syntax, eg:
<configuration>
<config>
<add key="repositoryPath" value="%HOME%\NuGetRepository" />
</config>
</configuration>
See https://docs.nuget.org/consume/nuget-config-file#environment-variables-in-configuration
The issue seems to be that the syntax
<configuration>
<system.webServer>
<modules>
<add name="HelloWorldModule" type="HelloWorldModule"/>
</modules>
</system.webServer>
</configuration>
is looking in the site bin folder, however as far as I can tell nop
commerce only puts a plugins dll in the Plugins folder.
What I've tried, that hasn't worked so far
putting the syntax in the web.config that exists in within the plugin folder
wrapping the syntax in the <location path="..."> tag
I realize that I could pull the class out into it's own project and manually drop the compiled dll into the bin, but I'd like to avoid this.
Has anybody used httpmodules within a Nop Commerce Plugin?
I use Asp.net 4, in my Web.Config (in the root for my site) I have this code
<pages enableViewState="true" theme="Cms-FE-01" validateRequest="true">
</pages>
I need exclude applying of theme="Cms-FE-01" for a subfolder.
Any idea how to do it?
I solve the problem adding in the sub folder a new web.config with this settings
<pages enableViewState="true" theme="" validateRequest="true">
</pages>
if you guys know another way please post. thanks!