rebuilding subsonic 2.2 - asp.net

I haven't programmed for 2 years so please be gentle in your answers. I'm returning to an old asp.net 2.0 project i wrote a few years ago using subsonic. I can't work out how i got subsonic working in this asp.net project as it is an old version (2.1) and the documentation for 2.x doesn't ring any bells with how I used to have to build the code. Anyhow, I have downloaded subsonic 2.2 and have managed to get that to work so I will use this in the website. However I have seen various webpages saying that subsonic 2.2 requires a very specific version of the mysql data connector (5.2.3 i think) and that I should rebuild subsonic 2.2 with a newer version of the connector.
Questions: is this necessary? If so why? Can't i just use version 5.2.3 of the connector in my website or does asp.net override it with its own version (by the way i generate my DAL in a separate class project and not the website itself)? Can i prevent this from happening? If this is necessary, how do i do it as I really can't remember. Would i just create a new project, add the subsonic source files and the appropriate connector dll and rebuild the subsonic dll or is it more involved than that? Is subsonic 2.2 still supported or am I flogging a dead horse trying to use it?
thanks a lot

As you generated your DAL in a separate class project then you should be able use whatever version of the MySQL adapter .dll you like in your web project.
The other option is to use SubCommander program to generate the classes.
I'd strongly advise grabbing the latest version 2.x from https://github.com/subsonic/SubSonic-2.0 and compiling your own. Failing that if the project isn't too large then maybe look at migrating away? SubSonic was a great tool at the time but there are much better options available now.

Related

How to properly change target framework to .NET 4.0

I built an application with target framework .NET 4.6 using MVC 5 and Entity Framework 6 using Visual Studio 2017 on my Windows 7 machine. I'm now being told that I should have built the application to target .NET 4.0 because the production environment only has 4.0 installed. So I changed the target framework to 4.0 but now the application will not build on my machine.
I'm guessing I also need to downgrade MVC and EF. How is the proper way of doing this?
And which versions of MVC and EF should I install?
Do I need to make any manual changes to web.config?
There is no "proper" way, you have 3 options, in my favorite order:
Update the server and install the latest .net version. (at the time .net 4.6). Make sure used libraries are up to date and not end of life.
Start over in a new project and make sure you target version 4.0: you can copy most of your source files. You'll probably get some compiler errors, but usually they are easily fixed. This way you'll have the benefit that the used template matches the framework and packages version(s).
Re-target the used framework in the project properties and replace the packages which are installed and hope for the best (sometimes you need other packages). Hopefully you used the package manager to install those packages. Maybe the update-packages command helps, but be sure to backup your project first. Some packages become obsolete after time, some are renamed. This is what will cause issues. Also, some of the Methods/API calls will be different, so some rework will be needed.
As for the rest of your questions:
I'm guessing I also need to downgrade MVC and EF. How is the proper way of doing this?
Use the nuget package manager
And which versions of MVC and EF should I install?
The nuget package manager will fix this for you.
Do I need to make any manual changes to web.config?
Sometimes: yes.

Project not compatible with netcoreapp2.0

I'm trying to add a full framework class library as a project reference to asp.net core 2.0 MVC project and getting the below error.
Project XYZ is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0).
Project XYZ supports: net462 (.NETFramework,Version=v4.6.2)
I have updated to the most recent version of Visual studio i.e, 15.3.5.
Is it even possible to reference 4.6.2 libraries in core 2.0 projects?
The first thing that you can try is to compile the library you want to consume as netstandard2.0.
Theoretically (according to the .net standard documentation), this will make it compatible with projects using net461 and later as well as netcoreapp2.0 and later.
In practice, sometimes you will end up with a problem with one of your dependencies that don't provide the same library version across different compilation targets.
In such cases you may simply need to add the .net core 2.0 as a target framework for the XYZ library.
The xml tag listing the targets is <TargetFrameworks> in the XYZ.csproj file and is not handled by the Gui of the project's properties.
So I would give a try at editing the XYZ.csproj by hand and add or replace what's listed as <TargetFrameworks> with netcoreapp2.0.
If you are adding it as additional target you need to separate them with ';' as in
<TargetFrameworks>net462;netstandard2.0;netcoreapp2.0</TargetFrameworks>
More details about this in this Microsoft doc.
Please keep in mind that this will trigger multiple compilations and will slow your build consequently...
It should be. Microsoft announced a ".NET Framework Compatibility Mode" with the release of .NET Standard 2.0. However, they didn't go into great detail about how it works exactly, or what to troubleshoot if it doesn't. Additionally, they only specific talk about it in relationship to Nuget packages, so it's possible there's some role Nuget is playing in the process, as well. Unfortunately, I've been unable to find any additional information about this feature outside of the announcement post.
That said, Microsoft's explicit recommendation is to not rely on the fact that your .NET Framework library may just happen to work in .NET Core; instead, you should be actively porting .NET Framework libraries you control to .NET Standard. I'd say you're likely going to spend more time trying to figure out why it doesn't "just work" than you would porting your code, so that it will definitely work, and be future-proof to boot.
The following solution worked for me.
Deleted bin and obj folders from all the projects in the solution, rebuild and if it still doesn't work try changing browser from debug options. for eg. If you already have chrome as default browser in Visual studio, switch to Edge or Firefox.

Is there any disadvantage in a long term to develop .Net core app which targets Net461?

I am trying to generate Well formatted Excel files from .Net Core and found ClosedXML library which runs only on .Net 4.61
I already tested the following libraries which work on .Net Core
OpenXML - Too many codes for a simple task and difficult for me to use
SyncFusion - Public / Government Organisation cannot use for free.
I changed the target to Net461, do the dotnet restore and all my codes are still running as usual and I could generate the Excel file with ClosedXML too.
What I would like to know is, is it a good approach? This is not a one-off small project and I am likely to maintain this website for another 3-4 years at least.
Is there any potential to lose the new functionalities and not able to use new Libraries from .Net Core in the future?
Or should I create another separate website running on Net461 and call that URL from my .Net Core app? So, I don't need to worry about losing new .Net Core functionalities in the future.
There is obviously no way to know the future, but the biggest thing you get with .Net Core over the full framework is the ability to run the app cross platform. So if cross platform isn't a concern, then going with the full framwork shouldn't be an issue. There is no question that the full framework will be fully supported for the 3-4 year time horizon you mentioned, in fact I think most developers would feel comfortable using the full framework even for a project with a much longer time horizon.
With regard to missing out on new .Net Core features, many of the features can be accessed even from libraries compiled for the full framework. For example I use the new encryption libraries found in Microsoft.AspNetCore.Cryptography (that are part of .Net Core) from my full framework class library. The net .Net Core libraries are just Nuget packages and as such can be referenced from non .Net Core projects.

How to convert .net 4.6 project to 5.0

Based on this question, I now know how to create a new project using the 5.0 framework (and have successfully done so), however is there an upgrade path to converting a 4.6 project (or earlier) to a 5.0?
I know there are a lot of changes in between the two frameworks, so maybe it has not yet been documented/developed - but I am not sure (and was unable to find the info), so figured I'd ask.
When going into project properties I am presented with:
Project Properties
Right click menu on project
Which are the two areas I would expect such a conversion be possible. Am I looking in the wrong place, or does the upgrade not yet exist (or even will it?)
.NET 5 doesn't exist yet. It is .NET 4.6 which was just released. The latest version of ASP.NET is version 5.0, which uses up to .NET 4.6. .NET Core 5 is a totally different thing, and there aren't predefined migration paths to it.
You can't just convert a regular ASP.NET 4 project to a ASP.NET 5 project since the introduction of the entirely new Core framework. You have to do it by hand yourself.
Generally speaking, you need to create an ASP.NET 5 project and then copy-paste useful code around.
The designs (MVC, Web API and SignalR) are different, so you could not easily migrate yet. Compared to those changes, the .NET Framework vs. .NET Core/DNX changes are subtle.
References
http://stephenwalther.com/archive/2015/02/24/top-10-changes-in-asp-net-5-and-mvc-6
http://docs.asp.net/en/latest/conceptual-overview/index.html

Creating an ASP.NET MVC app from scratch

So far i've only been using webforms. But me and my friend would like to try out the MVC architecture. Some questions:
Is there any downside with the free version of visual studio VS professional? I can get the professional version from work but is it worth the effort?
I would like to use Entity Framework and the latest version of MVC + the razor view engine. Does this need to be downloaded separatly?
As far as versioning is concerned; is tortoise SVN suitable for a small project on 2 persons?
Any help is appreciated, thanks.
SVN is ok as a repository in my experience. If you are using Visual Studio there is a decent plugin so you can use it from within the IDE, rather than from within Windows. If I am using SVN, it is what I use! More details here.
MVC3 can be downloaded here
Entity Framework can be installed via Nuget (PM> Install-Package EntityFramework ) or a quick google will show the download locations (I think there is version 4.3 and a CTP of version 5)
Free version will work, not sure if there are any differences.
Yes you need to download it seperately
Why wouldn;t it be?
Not that I know of. It's a good way to start. I know earlier versions didn't allow plugins but not sure about the latest versions.
EF will come with the .NET SDK (VS) so no need there. You can get MVC3 from the Web Platform Installer (http://www.asp.net/mvc/mvc3)
I use Tortoise SVN on a team of 4 people with no issues at all. Just make sure you all know good rules for source control management.

Resources