referencing a f# fsharp libary in blazor - f#

I am trying to reference a F# project(Class Library) in Blazor.
I add this to the Blazor.csproj and it compiles.
<ItemGroup>
<ProjectReference Include="FSharpLibrary\FSharpLibrary.fsproj" />
Great.
But when I add it to _Imports.razor I get the error message :
The type or namespace name 'FSharpLibrary' could not be found (are you missing a using directive or an assembly reference?)
Am I missing something or is this just not possible in Blazor?

Related

Missing 'Ajax' does not exist in the namespace 'System.Web.Mvc'

I am trying out examples from a book. The first one is really simple .. a few lines of code in a view (MVC).
I run the code but get an error :
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)
Source Error:
Line 22: using System.Web.WebPages;
Line 23: using System.Web.Mvc;
Line 24: using System.Web.Mvc.Ajax;
Line 25: using System.Web.Mvc.Html;
Line 26: using System.Web.Routing;
Source File: c:\Users\Aindriu\AppData\Local\Temp\Temporary ASP.NET Files\root\6882868f\b519e811\App_Web_index.cshtml.a8d08dba.h-o4pos5.0.cs Line: 24
I fixed the problem - I right clicked the solution in Solution Properties (on the right) and selected Manage Nuget Packages - i typed in MVC on top right search bar - and installed MVC.... it installed a whole load of files and my program worked..... but it added code to the solution I am working on..
Is there a easy way to get around this error ? I don't want to have to keep doing this every time I create a MVC program...
If you are using Visual Studio, from the project's References select the System.Web.Mvc dll. At the Properties Window set the Copy Local attribute to True.
You could even copy the necessary references to the bin\Debug or bin\Release directory (whichever you would use) manually, but setting it to happen automatically by Visual Studio is far better.
With newer versions of MVC, the preferred method is to use the NuGet package manager. Under: View > Other Windows > Package Manager Console. Type:
Install-Package Microsoft.AspNet.Mvc -Version 4.5.1
You should do this for every Mvc project.

Universal Image Loader namespace error

In Xamarin, I have added the "universal-image-loader-1.9.2-with-sources.jar" as a file in the "Jars" folder of a binding project, I have then built the application but I am getting one error.
Here is the error:
Error CS0234: The type or namespace name 'DiskLruCache' does not exist
in the namespace
'Com.Nostra13.Universalimageloader.Cache.Disc.Impl.Ext' (are you
missing an assembly reference?)
Can I please have some help to get this code working?
Thanks in advance
You need to add the binding project as a reference in your Startup project.
To do so click on References directory in you solution tree and select the binding project in the "Projects" tab.
Good luck!
You need to create the Bindings Library project and then add this jar into the folder Jars.
For fixing error:
The type or namespace name 'DiskLruCache' does not exist in the namespace 'Com.Nostra13.Universalimageloader.Cache.Disc.Impl.Ext'
add to Transforms\Metadata.xml
<attr path="/api/package[#name='com.nostra13.universalimageloader.cache.disc.impl.ext']/class[#name='DiskLruCache']" name="visibility">public</attr>

Error with NinjectValidatorFactory after updating FluentValidation with Nuget

I have the following line of code in my NinjectModule:
Bind<IValidatorFactory>().To<NinjectValidatorFactory>().InSingletonScope();
This used to work fine, but after doing a bunch of updates with Nuget, I'm getting the following errors:
Error 3 The type 'Ninject.Web.Mvc.FluentValidation.NinjectValidatorFactory' cannot be used as type parameter 'TImplementation' in the generic type or method 'Ninject.Syntax.IBindingToSyntax.To()'. There is no implicit reference conversion from 'Ninject.Web.Mvc.FluentValidation.NinjectValidatorFactory' to 'FluentValidation.IValidatorFactory'. D:\Projects\Current...\Configuration\MainModule.cs 19 13
Error 4 The type 'FluentValidation.ValidatorFactoryBase' is defined in an assembly that is not referenced. You must add a reference to assembly 'FluentValidation, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a82054b837897c66'. D:\Projects\Current...\Configuration\MainModule.cs 19 13
It's true that I don't have a reference to FluentValidation Version=2.0.0.0, but I do have a reference to FluentValidation Version=3.4.0.0.
According to the metadata...
IValidatorFactory and ValidatorFactoryBase are defined in Assembly FluentValidation.dll.
NinjectValidatorFactory is defined in Assembly Ninject.Web.Mvc.FluentValidation.dll.
In my References folder, I have FluentValidation v3.4.0.0 and Ninject.Web.Mvc.FluentValidation v3.0.0.0.
I don't get why the compiler thinks I need FluentValidation Version=2.0.0.0.
Am I doing something wrong, or is this an issue with the Nuget package?
It looks as if the problem is that FluentValidation used to be a signed assembly but is now an unsigned assembly. Ninject.Web.Mvc.FluentValidation, however, still thinks FluentValidation is signed.
If you look at these two assemblies in ILSpy, you will notice the following:
Ninject.Web.Mvc.FluentValidation references FluentValidation with the following attributes: FluentValidation, Version=2.0.0.0, Culture=neutral, PublicKeyToken=a82054b837897c66
The latest version of FluentValidation, however, has different attributes: FluentValidation, Version=3.4.0.0, Culture=neutral, PublicKeyToken=null
Note that PublicKeyToken has changed to null (unsigned).
Hopefully, there will be a fix to this soon. Meanwhile, the options are to roll back to the previous FluentValidation or fix the reference via a new fork.
Update
Just posted a bug report to Ninject.Web.Mvc.FluentValidation. Hopefully, this will ensure that the issue is resolved quickly.
Update 2
Just in case anyone missed it, the comment from #dismissile below contains a good solution. I gave it a try and it pretty much works. Here's a slight variation with more detail:
Remove all Nuget packages that contain "FluentValidation".
Use Nuget to install FluentValidation-Signed.
Use Nuget to install FluentValidation.MVC3-Signed (or MVC4-Signed)
Using Package Manager Console, enter the following:
Install-Package Ninject.Web.Mvc.FluentValidation -IgnoreDependencies
Note: I didn't need to manually add a binding redirect to my Web.config (although the Nuget package added one automatically).
The problem is correctly identified by DanM. Here is the comment from the project coordinator
"Going forward the primary nuget package will no longer be strongly named.
A separate package, FluentValidation-signed can be used if you absoloutely need strong naming, but it is recommended that you use the unsigned version." Jeremy Skinner

Problem with MvcContrib

I want to use MvcContrib Grid helper, but i stuck on the problem - it's not working.
I downloaded release for mvc 1, i have dll on my hard drive, i added a reference to my project, but i always getting following error:
Error 1 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Grid' and no extension method 'Grid' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
I am using Visual Web Developer 2008 if this is important
The question is: how correctly add this to my project?
Can you give me step by step instruction?
Thanks
Have you add the namespace in your web.config ?
<pages>
<namespaces>
...
<add namespace="MvcContrib.UI"/>
<add namespace="MvcContrib.UI.Html"/>
<add namespace="MvcContrib"/>
</namespaces>
...
</pages>
I don't think you have the reference to the MVcContrib dll added. See my sample app here:
http://weblogs.asp.net/rajbk/archive/2010/05/08/asp-net-mvc-paging-sorting-filtering-using-the-mvccontrib-grid-and-pager.aspx
Note that a reference has been added in the solution to the dll.

ASP.NET MVC + S#arp Architectur + Spark View Engine - Can't use ActionLinkForAreas

I decided to use ASP.NET MVC, S#arp Architectur and the Spark View Engine for my new project.
First i created a new project with the help of S#arp.
I tried to update the view of the S#arp Architectur to .spark files.
That works fine except for one exception left. The ActionLinkForAreas Method used in the Application.spark is not found in the HTMLHelper class:
error CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'ActionLinkForAreas' and no extension method 'ActionLinkForAreas' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
Call in Application.spark:
${Html.ActionLinkForAreas(c => c.Index(), "Home")}
The strange thing is it worked before i added the Spark View Engine
I would really appreciate your help
Just a guess, but I think you need to import the SharpArch.Web.Areas namespace so that it can be used in the Spark files.
In your Spark configuration do something like this:
var settings = new SparkSettings();
settings.AddNamespace("SharpArch.Web.Areas");
engines.Add(new SparkViewFactory(settings));
You can also do it in the specific .spark file at the top:
<use namespace="SharpArch.Web.Areas" />

Resources