MVC4 Project and ImageResizer - asp.net-mvc-4

Problem: MVC 4 test application with ImageResizer on any page access responds with "Could not load type 'ImageResizer.InterceptModule'"
To test and understand how ImageResizer works a MVC4 project was created in VS 2012, a single controller was created to display a HelloWorld page. Works as expected.
Next step was to add ImageResizer from NuGet. The ImageResizer Web.Config Installation for MVC was installed. This package added three additional packages:
ImageResizer Web.Config Installation
ImageResizer.MVC - MVC friendly utilitite
ImageResizer
Attempting to run the application results in a yellow screen of death with the "Could not load type 'ImageResizer.InterceptModule.'
Attempt to resolve with no success include:
Verify DLLs exist.
Remove and reinstall packages.
Copy ImageResizer dll from a working webforms application
Item 1 on the ImageResizer troubleshooting guide doesn't appear to be the issue "1.Your website has a 'sub-site' (Application Folder) inside it. Application Folders inherit all Web.config settings from their parent sites, yet expect to have their own copies of all the dlls referenced by those settings in their own /bin folder. You can resolve this problem by (a) changing the app folder to a virtual folder, (b) adding a copy of ImageResizer.dll and plugins into the /bin folder inside that application also, or (c) using statements in the child Web.config to cancel out the inherited statements from the parent Web.config. Option (c) will disable image resizing within the sub-application."
Yes there is a web.config file in the views directory. Tried creating and copying image resizer dlls to a bin directory in view - no success. Tried adding a remove to the web.config in the views directory. Again no success.

Problem resolved - self inflicted.
It seemed like a good idea to name the test project imageresizer. Which of course created a dll name imageresizer which walked all over the real imageresizer dll.

Related

NuGet package contentFiles artifacts installed as links in ASP.NET Core MVC project

We have an internal JavaScript library that we'd like to share between multiple projects. Actually we are already sharing it via file copying, but this has (predictably) resulted in multiple forks of the code.
The consuming projects are a mix of "full" ASP.NET (MVC and Web Forms) and ASP.NET Core MVC. (I'm planning on creating two separate packages.)
Installing into ASP.NET projects seems to work fine, but I'm having problems with ASP.NET Core.
Initially I had all the artifacts within a files element, and nothing at all was showing up in the consuming project. After re-reading the docs, I realized that ASP.NET Core projects would use a PackageReference ... so I would have to use a contentFiles element instead of (or in addition to) a files element.
I created a contentFiles folder and a script to copy the requisite files from the source project folder structure into contentFiles/any/any/wwwroot/lib/ourAwesomeWidget, and modified the package manifest accordingly.
This works. Sort of. The package appears to get build correctly. The files do get added to the consuming project, but they get added as links; the actual files (the link targets) reside in my local package cache.
The relevant portion of the package manifest is:
<metadata minClientVersion="3.3">
...
<contentFiles>
<files include="**/*" buildAction="Content"
copyToOutput="true" flatten="false" />
</contentFiles>
</metadata>
<files>
<file src="contentFiles\**" target="contentFiles" />
</files>
Part of the issue is that I don't find the docs very clear concerning contentFiles. All the examples show a single file element ... but the include attribute on the files element is required, so it's not clear what the individual file elements would even do.
Is there a way to get the actual files (not links) added to the consuming project? Or, alternatively, is there a way to get the package to install as a "normal" package (rather than a PackageReference)?
Update:
I did some further digging and found this answer by #Martin to a similar question -- but he answered this one before I had a chance to update it.
It appears this behavior (adding files as links) is by design.
I find this highly unsatisfactory, because (as #Martin points out), our JavaScript library will not be available during development on consuming projects.
But part 2 of my question still stands. According to the docs,
By default, PackageReference is used for .NET Core projects, .NET Standard projects, and UWP projects targeting Windows 10 Build 15063 (Creators Update) and later.
Is there a way to trigger the non-default behavior, i.e. allow .NET Core projects to consume packages other than via PackageReference?
contentFiles are supposed to be added as a link. The contentFiles section controls the msbuild items that are generated for these files into the obj\projectname.csproj.nuget.g.props file.
The copyToOutput="true" will cause the items to be copied to the output and publish directory. However that does not help you when running the application during development, since it will be run from the project directory, not the output directory.
Consider consuming client libraries via npm (since bower is deprecated).

Deploying a JavaFX Application with IntelliJ

Ive gone through tons of documentation and tutorials but nothing seems to work. Heres what i need
I want to package an deploy a desktop JavaFX application as a self contained package for Mac and Windows.
I want the application to have a custom icon (of course)
I want this application to be able to reference a text file that is in a resources folder (that can be modified by the user) to connect to a database.
Here is what i have tried:
Building artifacts in IntelliJ -This creates a jar with related 3rd party jars and a bundle folder with an exe and dmg. The icon is the default java one, and i cant reference by db.config file from the exe or dmg, i can reference it from the jar however
Generating an ANT build file - Once created this file contains errors complaining that various tags are not allowed and that properties are not defined.
Ive tried placing my .ico image which is the same name as my deployed application in every possible folder.
Im in serious need of help.
build.xml : http://tinypic.com/r/2md2zbn/8

Visual Studio 2013 Publish issue

I converted a VS2010 ASP.Net MVC3 project to VS2013 MVC4. Now when I publish, it is copying the contents of my project to the bin folder.
I can't understand what I did to make it do this..How do I fix it so it doesn't do it?
Your files are incorrectly set to copy to the output folder (\bin) during build. Make sure that the Copy To Output setting on each file is set to Do Not Copy.
Normally, you don't need to copy much of anything to your bin folder. When publishing, all of the content pages (*.aspx, *.html, *.css, etc) will get picked up by publish just by existing in the project. This is determined by the Build Action being set to Content. (Note: you can exclude files by setting the Build Action to None)
For code files, there's 2 ways it could go. in a Web Application project (which MVC is) most code files, such as controllers, models, or code behind files in WebForms, are compiled into your site's DLL already. These have Build Action = Compile, meaning they get compiled up front and don't need to be included in the publish. The exception to this is files in App_Code, which are deployed to your site (Build Action = Content) and compiled at runtime. You can also choose to pre-compile your site in the publish settings (Settings -> File Publish Options -> Precompile during publishing), which will process the App_Code files automatically (i.e. you can leave them as Build Action = Content and VS will compile them and publish the output instead).

ninject.mvc3 not loading modules

I'm using ninject mvc3 via nuget in a MVC4 webapi application. No changes made to global.asax I have created a ninjectmode and placed it in the bin folder. I'm noticing that the line
' bootstrapper.Initialize( CreateKernel)' in NinjectWebCommon.cs is throwing an exception 'Sequence contains no elements'.
If I delete the the dll containing my ninject module the error disappears.
What am I doing wrong? I would like go be able to use NinjectModules to separate concerns in my application.
Figured it out. Apparently, when you add Ninject.MVC3 to a class library project via Nuget, it adds an "App_Start" folder similar to how it does for a web application project. This was causing the above error. I removed the App_Start folder and life is good once again.

TFS 2010 - WebDeployment - indirect referenced assembly missing

We've got the following problem:
solution-structure:
AutofacRegistration
References: Repositories.dll
WebApplication
References: AutofacRegistration.dll
In our web application we are referencing the AutofacRegistration.dll and this assembly references Repositories.dll. Repositories.dll is instantiated on runtime per IOC-Container.
When we build the solution in VS2010 and browse the web app everything is working fine, as expected.
When we use our build server(TFS 2010) und use the web deployment, the Repositories.dll is missing the web-app\bin folder and we got a runtime exception(when we want to instantiated a class in Repositories.dll)
But Repositories.dll is in our drop location, so the web deployment target does not copy this file, any ideas how to solve this??
Have you tried a copy task from the BuildTemp location to where your Web Deployment Project can pick up the file it needs?
<Copy SourceFiles="$(OutDir)\Repositories.dll" DestinationFiles="web-ap\bin\Repositories.dll" />
The paths will need modified but you get the idea. I do a similar function in MSBuild to move a dll for our installer to pickup.