I'm trying to deploy a web role to Windows Azure it is says I can't target the .NET Framework 4.5. Apparently, only 3.5 & 4.0 are supported. If that is true, that leaves me in a bind because my web role is serving as my data portal using the CSLA 4.5.1 release, which I think requires .NET 4.5. I tried to change the Web role (and dependencies like my .NET library, DataAccess and DataAccess.Sql projects) to .NET 4.0 but then my Csla is broken.
Any thoughts on how to get around this? I am trying to get a WinRT application working using CSLA and was expecting to use Windows Azure to host the service and SQL database.
Get the latest source from trunk. I added a CSLA project that targets .NET 4.0 just before VSLive to enable this scenario.
This will enable you to create a Azure server in .Net 4.0.
I believe Rocky had a demo that demonstrated just this at VSLive.
You should also update to get the latest support for async/await keywords.
Thanks, Jonny. Could you point me in the right direction? I have not downloaded anything from the source code before, and I'm not sure what project to use in the Trunk. I see lots of things under Trunk, including CslaContrib, CslaContribu.Caliburn.Micro.Silverlight, etc. What should I choose?
Also...you're referring to the CslaContrib code on codeplex, right?
No,
This is the CSLA .NET (Current dev). See instructions in:
http://lhotka.net/cslanet/Repository.aspx
You need a SVN client to download the source code and then build on your computer.
The source code repository is readonly, publicly available for anonymous users.
Using TortoiseSVN, I get a message saying "Access to http://lhotka.net/cslacvs/viewvc.cgi/core/trunk" forbidden. I get this when trying to export to my local directory.
You must use the Subversion URI - NOT the Web View URI - as specified on the Repository page.
How do I find the Subversion URI? When I right-click on the directory to which I want to download the source, what URI do I specify?
Thanks (and sorry for the trouble).
Look at this page: http://lhotka.net/cslanet/Repository.aspx
The Subversion URI for project CSLA .NET (current dev) is svn://svn.lhotka.net/csla/core/trunk
Duh...not sure how I missed that. I'll give it a try.
Should I be using the Csla.Net4 project in the Source directory? If so, when I build I get the following exception: "System.Threading.Tasks.Task does not contain a definition for 'Run'."
Note: the exception occurs in DataPortalT.cs, line 491.
Yes, you should use the Csla.Net4 project.
Read this thread: http://forums.lhotka.net/forums/t/11559.aspx
Remember, this is a live repository - and there is still work in progress.
I'm making headway, but now I'm running into this:
Could not load file or assembly 'Microsoft.CompilerServices.AsyncTargetingPack.Net4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
However, I have already added (via NuGet) the Async Targeting Pack to the assemblies that I'm compiling against 4.0.
Just to summarize, here is the setup of my project...hopefully this is as it should be:
I don't know what I did, but it's not happening anymore. But I'm still getting weird behavior, though, which I'll have to research.
In the meantime, I would like to verify one thing based on the link that Jonny gave to the thread with Tiago. Tiago used the symbol NET45. Is that a custom symbol, or is that built in to VS? Thanks.
#if NET45
return Task.Run(() => dp.DoFetchAsync(objectType, criteria, true)).Result;
#else
return TaskEx.Run(() => dp.DoFetchAsync(objectType, criteria, true)).Result;
#endif
It is a compiler directive and variable that is defined in the "Project Properties".
I have updated trunk so the code will compile now - so update your copy of the code.
I now get the following error with one of my objects. I don't think I'm referencing Silverlight in any of my projects, so I'm not sure where to look. This happens somewhere after calling portal.BeginFetch(criteria) and is returned to my VM in the Csla.Xaml.ViewModelBase error event:
Could not load type 'Csla.Silverlight.PrimitiveCriteria' from assembly 'Csla, Version=4.5.1.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30'.
Stack trace:
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName)
at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
at Csla.Reflection.MethodCaller.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) in c:\Users\Tim\Documents\Visual Studio 2012\Projects\CslaTrunk\Source\Csla\Reflection\MethodCaller.cs:line 191
at Csla.Reflection.MethodCaller.GetType(String typeName) in c:\Users\Tim\Documents\Visual Studio 2012\Projects\CslaTrunk\Source\Csla\Reflection\MethodCaller.cs:line 211
at Csla.Serialization.Mobile.MobileFormatter.GetTypeFromCache(String typeName) in c:\Users\Tim\Documents\Visual Studio 2012\Projects\CslaTrunk\Source\Csla\Serialization\Mobile\MobileFormatter.cs:line 188
at Csla.Serialization.Mobile.MobileFormatter.DeserializeAsDTO(List`1 deserialized) in c:\Users\Tim\Documents\Visual Studio 2012\Projects\CslaTrunk\Source\Csla\Serialization\Mobile\MobileFormatter.cs:line 233
at Csla.Serialization.Mobile.MobileFormatter.Deserialize(Stream serializationStream) in c:\Users\Tim\Documents\Visual Studio 2012\Projects\CslaTrunk\Source\Csla\Serialization\Mobile\MobileFormatter.cs:line 217
at Csla.Serialization.Mobile.MobileFormatter.Deserialize(Byte[] data) in c:\Users\Tim\Documents\Visual Studio 2012\Projects\CslaTrunk\Source\Csla\Serialization\Mobile\MobileFormatter.cs:line 375
at Csla.Server.Hosts.Silverlight.WcfPortal.GetCriteria(Byte[] criteriaData) in c:\Users\Tim\Documents\Visual Studio 2012\Projects\CslaTrunk\Source\Csla\Server\Hosts\Silverlight\WcfPortal.cs:line 222
at Csla.Server.Hosts.Silverlight.WcfPortal.Fetch(CriteriaRequest request) in c:\Users\Tim\Documents\Visual Studio 2012\Projects\CslaTrunk\Source\Csla\Server\Hosts\Silverlight\WcfPortal.cs:line 91
I think I got past this for now (although I'm not sure why the problem exists). Since the message referred to the PrimitiveCriteria, I tried changing my criteria as an Int to a class containing an int property and passing that to the DP_Fetch method. That resolved the issue. Is this to be expected in the future, i.e. will we be restricted from passing primitive types to the DP methods? Thanks.
You should expect existing code to work, including PrimitiveCriteria. I'm not sure why that's failing.
The Silverlight references in the stack trace occur because WinRT uses the "Silverlight" data portal. I'm considering renaming that to the "Mobile" data portal to avoid this confusion, though that introduces another breaking change from 4.3...
BTW, if you want to use .Net 4.5 on Azure, please go over to the Azure UserVoice site and vote for the support so that the Microsoft PMs are aware of how much the community wants 4.5. Here's the link: http://www.mygreatwindowsazureidea.com/forums/34192-windows-azure-feature-voting/suggestions/2598170-iis8-and-asp-net-4-5-support-in-azure-platform
Copyright (c) Marimer LLC