In short: I've got a library. It's not currently Windows Phone 8 compatible, and I'd like to make it so. What I'm wondering is does Visual Studio have an easy way of porting a current class library project from one version of .NET to another?
You can change your project to a portable class library (PCL). Normally you'd start with a PCL from scratch, but there is a hacky way to convert an existing library. Which is described in this blog post:
http://geekswithblogs.net/imilovanovic/archive/2012/08/31/vs2012---how-to-manually-convert-.net-class-library-to.aspx
Once your library is a PCL, you can enable windows phone as a target, and you'll get exceptions on everything that is not comparable.
Related
I'm currently converting a VS solution of a C# web application targeting .NET Framework 4.8, that has interop to C++ native libraries using C++/CLI as a bridge.
My goal is to port it to .NET 6, and make it all cross platform, so C++/CLI has to go. Also I need to make changes to my C++ native library projects which currently have dependencies to Windows SDK.
I've read that CMake is the way to go, and that VS 2022 has good support for it. I'm trying to set up a sample solution that has a single C# project and a CMake project, but it has proven to be very challenging.
It's like there is no such thing as a CMake project, but rather just a folder with a special CMakeLists.txt file.
When I add a CMake project it unloads the VS solution file, and the whole IDE changes to the Opened Folder mode. I cannot add an existing CMake project to a solution, because there is no project file.
The experience is sub-optimal.
The VS solution I'm trying to convert has a handful of C# and C++ projects, and it would be nice to be able to keep them all in the same solution.
Am I doing something fundamentally wrong? Should I be using something else instead of CMake?
To extend a third party MFC application I must create a desktop static MFC class library (i.e. dll). Using C++ I successfully completed the logic/backend portion of the project. With the aid of C++/winrt nuget package, I had a wealth of APIs that helped. Note my preferred language is C# with Visual Studio should that be relevant.
For the user interface I would like to completely use WINUI 3 instead of MFC APIs. Currently a desktop win32 WINUI solution must include a packaging project (i.e. MSIX) to get the required APP ID. This seems like a fundamental problem since I must produce a MFC dll and not a full blown application/exe install. If necessary I can wait (Not preferred) for Windows APP SDK 1.0, but I need to confirm this solves my problem and a release is coming.
Alternatively I may need to use WinRT XAML hosting API (XAML islands). This has limitation, but is this still the best/only viable option for WINUI in a C++ MFC desktop unpackaged app?
Basically how can I best utilize WINUI 3 in my MFC class library project?
I have problems creating F# portable project which than should be referenced from C# portable project. When adding such reference, the following message appears:
Unable to add a reference to 'PortableLibrary1'. Portable Library projects can only reference other Portable Library projects and assemblies.
The problem is easily reproduced using latest Visual Studio 2015 Update 1 (version 14.0.24720.00). I also have Xamarin installed.
I can reproduce the problem using any kind of C# portable project with following available:
Class Library (Portable)
Class Library (Portable for iOS, Android and Windows)
and with any kind of F# portable library project with following available:
Portable Library (.NET 4.5, Windows Store, Silverlight 5, Xamarin) [Profile 47]
Portable Library (.NET 4.5, Windows Store, Windows Phone 8 Silverlight, Xamarin) [Profile 78]
Portable Library (.NET 4.5, Windows Store, Windows Phone 8.1, Windows Phone Silverlight 8, Xamarin) [Profile 259]
Portable Library (.NET 4.5, Windows Store, Xamarin) [Profile 7]
I've used the same profiles for C# as for F# and nothing helps.
Seems like there already was a such issue before (How do I add a reference to F# Portable Library from C# Portable Class Library (PCL)) which then was successfully fixed. But it is now reproduced again.
Can somebody please tell me am I missing something? Maybe there is something which needs to be additionally installed or so?
I just had the same issue. I solved it with hacking the .csproj of my PCL. After that the F# PCL is referenced in the C# project and I can use everything. I don't know if there are any problems - I could not figure out any.
Here are the steps to reproduce:
new C# project (portable class profile 111)
new F# project (portable class profile 7)
look into F# .fsproj file and copy value of "Project/PropertyGroup/ProjectId"
edit C# .csproj and add following itemgroup
<ItemGroup>
<ProjectReference Include="..\F# Project\F# Project.fsproj">
<Project>{F# Project Id}</Project>
<Name>F# Project</Name>
</ProjectReference>
</ItemGroup>
I'm using Visual Studio 2015 Community with Update 2
If there is indeed a bug and you want to call something from the C# PCL library into the F# PCL one, a way to work arround that could be to add the C# library as a reference to the F# library instead (the other way arround).
Then the F# code will implement an interface (see https://msdn.microsoft.com/en-us/library/dd233207.aspx) that you define at the C# side.
It will also call a method you provide at the C# side to give you a reference of a class instance that implements the interface (that is implemented at the F# side). Alternatively you can use MEF (Managed Extensibility Framework - https://blogs.msdn.microsoft.com/jomo_fisher/2010/03/09/neat-samples-extend-your-f-program-with-mef/) to pass that interface implementation from the F# side to the C# side, with the C# side initiating the request for the "binding" (also read about Inversion of Control / Dependency Injection)
I created a Portable Class Library the other day in VS2013. It targeted the following platforms:
.NET Framework 4.5
Windows 8.1
Windows Phone 8.1 (non-Silverlight)
My question is, can this be used in Xamarin projects such as Xamarin.iOS or Xamarin.Android? I've found a project claiming to support Xamarin, but grepping the solution and project files for "ios" and "android" turn up nothing. If not, what can I do to make my library portable to those platforms?
Thanks.
You need to install Xamarin for Visual Studio first if you haven't already
Open your PCL project and change the target profile to include the Xamarin platforms you want to support. (e.g. Profile 78)
Optionally retarget all your dependencies (projects/nugets)
Recompile your PCLs
You should now have dlls that work also in Xamarin.
You'll have to make your project target those platforms and then recompile your .dlls in order to make them available for Android and iOS.
I don't know what is the edition of your Visual Studio, but the options to target Android/iOS should be available in VS2013. In any case, try downloading Visual Studio 2015 community (which is free), open your project using it and the option should be there.
If none of this works, you can also try manually changing your .csproj file to a different profile. This is stated to have worked on this answer.
I have joined a project that has been written in xcode using objective-C that is using some frameworks. This project is aimed at adding Wii-mote functionality to both the windows and Macintosh versions of Unity3d.
My question is how should I go about getting a windows dll that mirrors the functionality of the Macintosh .bundle/.dylib?
Do I need to start translating the code from Objective-C to C#?
or,
Do I need to find/code my own windows .dll from scratch?
or,
Is there a library type that is compatible with both windows and Macintosh?
Thanks in advance for your help!
There is not a library type that is compatible with both systems. It might be possible to use C# libraries on both systems if you're using Mono on the Mac to run C# code, but you already stated that it's an Objective-C project, so I'm guessing that option is out.
So yes, you'll need to write your own .dll on the Windows side in your language of choice.