I tried to upgrade to CSLA version 4.5.20 but i am getting the error " Could not load file or assembly 'System.Threading.Tasks". Seems that this error is related to some kind of incompatibility between VS2010 and Microsoft.Bcl.Async packages.
The main reason for this upgrade is because i want to define the transaction isolation level in the transactionscope attribute or change the isolation level from the default of serializible to read commited for the whole windows application, and seems that only this latest version of CSLA supports that.
Can anyone please help me to solve my problem ?
Are you installing from NuGet? If not, remove all CSLA references by hand and install from NuGet.
If installing from NuGet, remove all CSLA packages and also:
Now install from NuGet.
Note you should remove everything that is to be removed. After that, NuGet will delete the install packages and then you can start installing CSLA .NET 4.5.20. By the way, if you select Include Prerelease instead of Stable Only you will install 4.5.23-Beta that is more stable than 4.5.20.
EDIT
BTW This is valid for VS2012 and VS2010.
Tiago, CSLA 4.5.23 is installed correctly in my system. After that i go to my VS2010 solution and remove all the references to the old CSLA.dll and add the references that point to the new CSLA.dll. My solution is build successfully, but whenever it tries to access the database (execute a fetch operation from the data layer) i get the following message " Could not load file or assembly 'System.Threading.Tasks....."
CSLA 4.5 requires the new compilers that come with VS1012, so you can not use VS2010.
I have a team of developers working with VS 2010, in a huge project. I needed that transaction isolation attribute, that's the main reason for me to upgrade to CSLA 4.5.23. So Rocky are you telling me that the only solution is to upgrade to VS 2012 ?
Or you can back-port that feature change to version 4.3.
The change detail is available here:
It is the first time for me to try and compile CSLA with replaced files, anyway thanks for your help. Don't you think that upgrading to vs2012 in order to use the latest CSLA can be very troublesome to some of us, specially if we are not using any of the features of that Microsoft.Bcl.Async package?
CSLA 4.5 requires the new compilers that come with VS1012, so you can not use VS2010.
I build projetcs using CSLA .NET 4.5.x targeting NET 4.0 with no problems. On those projects I don't use async/await nor do I use the DataPortal_XYZAsync (like DataPortal.FetchAsync).
If you take your pristine 4.3.x code and reference CSLA .NET 4.5.x, it will build on VS2010.
[quote user="RockfordLhotka"]
CSLA 4.5 requires the new compilers that come with VS1012, so you can not use VS2010.
I build projetcs using CSLA .NET 4.5.x targeting NET 4.0 with no problems. On those projects I don't use async/await nor do I use the DataPortal_XYZAsync (like DataPortal.FetchAsync).
If you take your pristine 4.3.x code and reference CSLA .NET 4.5.x, it will build on VS2010.
Tiago, i am doing the same thing, referencing CSLA 4.5.x in my projects and the solution build successfully with no modification. I am not using any DataPortal_XYZAsync methods (may be they are implemented in data layer but not used in the other layers). Despite this i continue to get the error.
At some projects I got duplicated lines on the csproj file
<Import Project="..\..\..\Dependencies\packages\Microsoft.Bcl.Build (...)
that were referencing the pre-release package. I had to remove the duplicates by hand.
At some projects I got duplicated lines on the csproj file
<Import Project="..\..\..\Dependencies\packages\Microsoft.Bcl.Build (...)
that were referencing the pre-release package. I had to remove the duplicates by hand.
Tiago, thanks for your time and effort but i have no ..\..\..\Dependencies\packages\Microsoft.Bcl.Build in my project. I remove all the csla.dll references from my project, and then i try for the first time to install with NuGet
PM> Install-Package CSLA-Core -Pre
Still the error persist.
At some projects I got duplicated lines on the csproj file
<Import Project="..\..\..\Dependencies\packages\Microsoft.Bcl.Build (...)
that were referencing the pre-release package. I had to remove the duplicates by hand.
Below is the stack trace for the error
System.IO.FileNotFoundException was caught
FileName=System.Threading.Tasks, Version=2.5.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
FusionLog==== Pre-bind state information ===
LOG: User = .........
LOG: DisplayName = System.Threading.Tasks, Version=2.5.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Projekte/CSLA/MHS.Desktop/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Csla, Version=4.5.20.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projekte\CSLA\MHS.Desktop\bin\Debug\MHS.Desktop.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.Threading.Tasks, Version=2.5.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
Message=Could not load file or assembly 'System.Threading.Tasks, Version=2.5.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source=Csla
StackTrace:
at Csla.DataPortal`1.DoFetchAsync(Type objectType, Object criteria, Boolean isSync)
at Csla.DataPortal`1.Fetch(Type objectType, Object criteria)
at Csla.DataPortal`1.Fetch(Object criteria)
at Csla.DataPortal.Fetch[T](Object criteria)
at MHS.Business.ApSysuserList.GetByCriteria(ApSysuserCriteria criteria) in C:\Projekte\CSLA\MHS.Business\Collections\ApSysuserList.Generated.vb:line 79
at MHS.Desktop.frmApLogin.UsernameTextBox_LostFocus(Object sender, EventArgs e) in C:\Projekte\CSLA\MHS.Desktop\frmApLogin.vb:line 24
InnerException:
Message=Could not load file or assembly 'System.Threading.Tasks, Version=2.5.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
If we put things in perspective, it seems the System.Threading.Tasks.dll isn't there. As far as I can see this happens client side, when you try to call the DaataPortal code.
If you close VS2010 and run your EXE, you'll get the same error, right? So "there" means the folder where the build process puts the client files. Is the DLL there? What version is it? 2.5.16.0 or 2.5.19.0?
Does your app.config file include a block like this?
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.19.0" newVersion="2.5.19.0" />
</dependentAssembly>
</runtime>
If you are using the prerelease version, it shouldn't, otherwise it must be there.
Copyright (c) Marimer LLC