I add Suave.io to my project - so far empty - via NuGet and that's alright. But none of the open Suave declarations work yielding "The namespace or module "Suave" is not defined."
The following works in script file though:
#r ".../Suave.dll"
open Suave
Targeting .NET 4.7 (rather than 4.5.2) solved the issue. Wierd
Related
I am playing with .NET Standard and found strange that if I have the following project.json specified for both a .NET Core class library (xproj) and a Portable Class Library (csharp), only the latter can be properly referenced from a Xamarin.Android project:
{
"supports": {},
"dependencies": {
"NETStandard.Library": "1.6.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1"
},
"frameworks": {
"netstandard1.4": {}
}
}
I can add both as a reference, dotnet update works as expected (or at least no error messages shown), but the .NET core library is not realized:
type or namespace could not be found
I find this strange, since I'd expect any .NET standard targeting library to work properly. Am I doing something wrong or intentionally only PCLs are supported from Xamarin?
I assume you have a .csproj for the Xamarin.Android project and an .xproj for your .NET Core class library, which is targeting .NET Standard.
I believe the issue might be because of the different project systems we currently have and where each of them expects to find built assemblies for project references.
A workaround is to manually edit the .csproj to include the reference with the correct hint path. For example:
<Reference Include="SomeOtherClassLibrary">
<HintPath>..\SomeOtherClassLibrary\bin\$(Configuration)\netstandard1.6\SomeOtherClassLibrary.dll</HintPath>
</Reference>
You may also need to manually add a build dependency from the Xamarin.Android to the class library project to ensure the projects are built in the correct order (right click the Xamarin.Android project in Solution Explorer Build Dependencies > Project Dependencies...).
In summary, it's not that .NET Standard targeted libraries don't work with Xamarin, or that Xamarin only supports PCLs. It's a quirk with project references and the current state of the tooling, which I am sure will improve in time.
I have an F# library that uses the .Net 4.5 HttpClient. It compiles just fine but when I try to call functions in the library after loading it in a script the script says it can't find System.Net.Http.
Both the script and the library are in the same project targeted at .Net 4.5.
The library (in TdApi.fs) does this open System.Net.Http; but when the script does this #load "TdApi.fs" the error in the interactive window is this TdApi.fs(6,17): error FS0039: The namespace 'Http' is not defined.
I'm using VS2012 and am just getting started in F#.
There is a difference between a compiled library and a script file.
When you compile your TdApi.fs file as part of a library project, the dependencies (in your case, the HTTP library) are specified in project properties. The compiler uses the fsproj file to find the dependencies (and so everything compiles fine).
When you #load your TdApi.fs file from a script, it does not know about the project - and so it also does not know about the dependencies. To fix this, you can either use #r "TdApi.dll" where TdApi.dll is the compiled library, or you can use something like:
#r "someplace/System.Net.Http.dll"
#load "TdApi.fs"
So, you can use #r to explicitly load the HTTP library first and then TdApi.fs will see it.
I've been playing around with the Starter Edition of Xamarin Studio to determine if it will meet my needs. I understand (so I thought) the limitations of this edition; 32K compiled IL limit, no native libraries, etc. Now, I understand native libraries to be C/C++ libraries, or even native Java libraries. This does not seem to be the case.
I have a solution in Xamarin Studio with 2 projects. One is an Android Class Library, the other is an Android Application. When I reference the class library from the application project and build, I get the following error.
Your app references native libraries. This functionality requires Indie Edition or higher.
I beg to differ! Every .cs file in the referenced Android class library project is simple .NET code. What am I missing? I can successfully run the Tasky Android_Starter solution without issue, and it is made up of 2 projects like mine.
I had to delete the Resources folder and manually edit the Android class library project file in order to get this working. I looked at the Tasky sample's project file as a reference.
After deleting the auto-included Resources folder from the project, edit the .csproj file in a text editor to remove the following XML elements:
Project\ProjectGroup\AndroidResgenFile
Project\ProjectGroup\AndroidResgenClass
With those things taken care of, I no longer get the error. I'm guessing, Xamarin Studio thought I was referencing another Android application instead of a class library. Not sure why the default project template includes things to break such a flow, but perhaps I'm not "doing" right" either. Go figure.
Deleting the Resources folder and manually editing the csproj file didn't work for me. I had to create a new C# Library project instead of creating an Android Library Project and import my .cs files into that. After that it compiled and ran fine.
I'm adding a third party dll reference to my F# project. I added the dll in references and when I use this i.e highlight the code and do Alt+Ent, I get the error "The namespace or module 'AZROLESLib' not defined." Am I missing some thing.
In short, you have to use #r "/path/to/AZROLESLib.dll" in order that F# Interactive recognizes and loads the dll file.
Adding a dll reference helps Visual Studio to find correct libraries when compiling the project, but it has nothing to do with F# Interactive. Therefore, you have to use #r directive to point to AZROLESLib.dll. If VS has some troubles to highlight the code,
you may have to open the exact module in your dll file:
open AZROLESLibModule
If the code is in a *.fs file, you may want to distinguish between using fsi and using fsc:
#if INTERACTIVE
#r "/path/to/AZROLESLib.dll"
#endif
for some things you can call them directly by name with no path
#r "EnvDte"
works for vs2013 here for instance
In my case my F# project was referencing a C# DLL but I had the same issue, "The namespace or module 'MyModule' not defined", when doing "open MyModule".
The solution was to edit the settings to use the same framework (one was using 4.5 and the other 4.0).
I'm building a silverlight project based on the Prism 2.1 version.
Added a shell
Added a silverlight class library (Module A)
Added a reference of module A to the shell
Added ModuleA in the bootstrapper to the Prism ModuleCataloge
Every thing is ok .
I wanted to make loading the Modules by XAML file.
- Added ModulesCatalog.xaml to the shell
- Removed ModuleA reference from the shell.
- added ModuleA configuration to ModulesCatalog.xaml.
- Changed to bootstraper code with configuration statement (ModuleCatalog.CreateFromXaml())
When I run the project it sayes that ModuleA doesn't exsits. I think this is because it don't exsit in the silverlight bin library .
How can solve the problem.
Thanks in advance...
The module needs to be on the server (most likely under the ClientBin folder). There are a couple of ways to solve your problem but for an easy quick way to do this you could just add a new SilverlightApplication Project to your solution and simply create a reference to your dll project (ensure the new SL app project is deployed to the ClientBin folder). The xap file will contain the dll file and don't forget to update your modulecatalog.