We had an asp.net web application developed in csla (3) with visual studio 2008, aps.net 3.5 C#
Now we want to upgrade it to aps.net 4 or 4.5 with vs2010 or later.
Questions:
1. Can current csla (3) be able to update directly with vs2010 or later without any changing?
2. If we want to upgrade to csla 4 or later with vs2010, what needs to be changed? Any instructions?
Thanks
John
As long as you don't want to use any of the new features of .NET 4 or 4.5 or the new features of the C# compiler then yes, you should be able to keep using CSLA .NET version 3.0.5.
Disclaimer: I haven't actually _tried_ to do this, but I've heard from other people that version 3 will continue to work.
The thing is that most people upgrade to newer versions of .NET and/or C# to get access to new features, such as async/await, ASP.NET MVC, etc. And if that's your goal then you'll need to use more current versions of CSLA .NET that support these newer platform and language features.
I have a similar issue. My whole solution targets 4.5 but CSLA component remains 3.5. I am not able to login to the application. I'm not able to download CSLA 4.5 from NuGet as it says my framework targets 3.5.
That is because CSLA 4.5 only supports .NET 4.5 and .NET 4.0.
That is because CSLA 4.5 only supports .NET 4.5.
Jonny,
Per the download page, http://www.cslanet.com/Download.html 4.5.30 supports .NET 4. Or is the download page wrong?
I need to know which version to use with .Net 4.0. I'm migrating from your 3.6.3 N2 version and targeting .Net 4.0.
I'm also using Winforms UI but those questions will come later after I do some more forum searching...
Thank you,
Jeff Young
Hi,
If you are moving from 3.6 to 4.5 the read my blog post https://jonnybekkum.wordpress.com/2013/10/07/csla-validationthe-new-nuget-package-in-csla-net-4-5-40/
On the other hand - you should also be able to just change reference to CSLA 3.6.3 (or newer 3.x) for .NET 3.5 and retarget your project to .NET 4.5 or .NET 4.0 and just recompile with hardly any change in your code.
CSLA 3.6.3 N2 has a reference to LinqBridge (to get linq 2 objects in .NET 2.0) that you must make sure to remove from your projects references. And CSLA 3.6.3 N2 is for .NET 2.0 only. If you are on .NET 3.5 the use the official release for .NET 3.5.
And CSLA 4.5 does support both NET 4.5 and .NET 4.0 but you will need to do a fair amount of changes to move your code from v3.6.3 to v4.5.x and all the new features.
Jonny,
Thank you for responding so quickly.
I don't need the new features yet. I just need to get away from my .Net 2.0 dependency and move it up to .Net 4.0/VS2010. The current code set does no Validation/Business Rules so I don't have to worry about that yet.
I'm hoping I can swap out 3.6.3 N2 references for .Net 4.5 references and be done for this round. Adding new features to the app can come later.
And CSLA 4.5 does support both NET 4.5 and .NET 4.0 but you will need to do a fair amount of changes to move your code from v3.6.3 to v4.5.x and all the new features.
Just the changes described in your blog post? Or are there others?
Jeff
Yes, many others so if you want to go down that road make sure to read the change logs and all breaking changes.
The easiest path for you is to change references to to CSLA 3.x.x for .NET 3.5 and compile existing code for .NET 4.0 or 4.5.
Jonny or Rocky,
I have downloaded v4.5.30, built it in VS2013 (Changed target for CSLA.NET4 and CSLA.Windows.NET4 to .Net 4.0 instead of client profile). All went well. Everything built.
replaced the reference in my VS2010 targeting .NET 4.0 (not client profile) app and built. errors indicating csla namespace cannot be found. What did I do wrong? What blindingly obvious thing am I missing?
Thank you,
Jeff
I finally got it to build after using nuget to grab all the dependencies. Changed all the Criteria and CommandBase decendants and it builds... yay!
Of course I celebrated too soon...
"An exception of type 'System.InvalidCastException' occurred in Csla.dll but was not handled in user code
Additional information: Csla.Core.ContextDictionary cannot be cast to Csla.Core.ContextDictionary. Type A originates from 'Csla.3.6.3, Version=3.6.2.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30' in the context 'Default' at location 'C:\Windows\assembly\GAC_MSIL\Csla.3.6.3\3.6.2.0__93be5fdc093e4c30\Csla.3.6.3.dll'. Type B originates from 'Csla, Version=4.5.40.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30' in the context 'Default' at location 'C:\projects\OHSNational\ProjectManager\v1.5_VS2013test\__Deploy\Debug\Csla.dll'."
It's finding the old version in the GAC. I tried adding
<dependentAssembly><assemblyIdentity name="Csla" publicKeyToken="93be5fdc093e4c30" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.5.40.0" newVersion="4.5.40.0" /></dependentAssembly>
but the error is the same. Any other way to prevent it from going to the GAC first?
Any luck getting it to work?
Do you use N-tier deployment?
I suspect that your Server tier is using CSLA 3.6.3 and your client is upgraded to another version.
I just found that my app.config file is using .asmx and not .svc. Is there a different approach to make it work in IIS 7
Ok I got the sample application up and running to target 4.5 framework following your steps. The problem is my project is so huge and CSLA is bound in the same application. Thanks for the steps Jonny.
Hi,
If you are using CSLA 3.6 or later (and use RegisterProperty ) in you bunsiness classes you may also look at my blog post on how to use the new Csla.Validation package to ease migration to CSLA 4.5
http://jonnybekkum.wordpress.com/2013/10/07/csla-validationthe-new-nuget-package-in-csla-net-4-5-40/
Hi Jonny,
Forgive me if this is a simple question. If I want to migrate my project to 4.5 but leave my CSLA as 3.5, is that possible without touching the code? And what CSLA version should I use 3.5 or upgrade to 4.5 to be in par with my 4.5 target framework.
Hi,
You basically keep the existing CSLA assembly references and change the target framework on (retarget) all your assemblies to .NET 4.5
It is only when you want to use .NET 4.5 specific support in CSLA (like the new rule enging, async/await support in DataPortal etc) that you need the latest CSLA version.
Hi Jonny,
My DAL is built separately and they have used CSLA data portal. I followed your example of compiling all the assemblies to 4.5 and still the same problem. Anyway to make this work, got a deadline.
Is the client and server build on the same version of .NET?
Which communication protocol do you use in the DataPortal? (Remoting, ASP.NET Webservice, WCF)
What is the exception you get?
Just for fun - I downloaded the CSLA 3.0.5 for the download page http://www.lhotka.net/cslanet/download.aspx and:
My changes in PtWin app.config:
<appSettings> <add key="CslaAuthentication" value="Csla"/> <!--<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.RemotingProxy, Csla"/> <add key="CslaDataPortalUrl" value="http://localhost:3187/RemotingPortal.rem"/>--> <!--<add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WebServicesProxy, Csla"/> <add key="CslaDataPortalUrl" value="http://localhost:4334/WebServicePortal.asmx"/>--> <!--<add key="CslaDataPortalProxy" value="EnterpriseServicesHost.EnterpriseServicesProxy, EnterpriseServicesHostcs"/>--> <add key="CslaDataPortalProxy" value="Csla.DataPortalClient.WcfProxy, Csla"/> </appSettings> <system.serviceModel> <client> <endpoint name="WcfDataPortal" address="http://localhost:3564/WcfPortal.svc" binding="wsHttpBinding" contract="Csla.Server.Hosts.IWcfPortal"/> </client>
Hi Jonny,
I am testing it on my local machine.
And my stack trace:
[ArgumentNullException: Value cannot be null. Parameter name: key] System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +14223553 System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) +20 Csla.Security.ObjectAuthorizationRules.GetRoles(Type objectType) +122 Csla.Security.AuthorizationRules.GetAllowEditRoles(Type objectType) +59 Csla.Security.AuthorizationRules.CanEditObject(Type objectType) +107 Csla.DataPortal.Execute(Type objectType, Object criteria) +1556 Csla.DataPortal.Execute(Object criteria, Type type) +90 ASI.MDW.DataAccessLayer.Core.ExceptionLog.ExecuteCommand(ExceptionLogCriteria& criteria) +220 ASI.MDW.DataAccessLayer.Core.ExceptionLog.LogException(Exception exception, String ipAddress, String agent, String hostName, String url) +150 MDW2.ExceptionLog.LogException(Exception ex) in C:\My Projects\DEC 6 MDW Migration\MDW\Classes\ExceptionLog.vb:12 MDW2.Administration.Controls.Logon.ProcessLogon() in C:\My Projects\DEC 6 MDW Migration\MDW\Administration\Controls\Logon.ascx.vb:347 MDW2.Administration.Controls.Logon.Submit_Click(Object sender, EventArgs e) in C:\My Projects\DEC 6 MDW Migration\MDW\Administration\Controls\Logon.ascx.vb:285 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +153 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804
Copyright (c) Marimer LLC