13 Replies Latest reply on Aug 26, 2011 12:55 PM by spilon

    Does AF SDK require .NET Framework 3.5 or 4.0?

    Development

      Hi

       

      I have not found an official list of compatibility between the various versions of AF SDK  and the versions of  .NET Frameworks. Does one exist?

       

      Searching for that information, I found a previous post in these forums, which said that" AFSDK uses WCF to communicate to the AF Service which is only available in .NET 2.0.  In addition, there are changes to .NET DateTime in .NET 2.0 that AF makes specific use of.  " (from URL: http://vcampus.osisoft.com/discussion_hall/development_with_osisoft_sdks/f/28/p/852/4005.aspx#4005)

       

      Based on our own testing with OSIsoft.AFSDK.dll, version 2.0.0.0, we found implicit dependencies on libraries in .NET 3.0 and .NET 3.5:

       

      Here is a sample warning that I get when trying to target .NET 2.0:

       

      "Warning        The primary reference "OSIsoft.AFSDK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6238be57836698e6, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "OSIsoft.AFSDK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=6238be57836698e6, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".    "

       


      It also wanted to find  "System.Core, Version=3.5.0.0", "WindowsBase, Version=3.0.0.0" ,"System.IdentityModel, Version=3.0.0.0"  and "System.IdentityModel.Selectors, Version=3.0.0.0" .

       

      My conclusion is that AF SDK version 2.0 requires .NET 3.5 or .NET 4.0. Is that correct?

       

      Regards,

       

      Nils A Thommesen, ExproSoft

        • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
          skwan

          Nils:

           

          AF 2.3 (the current latest version) requires .NET 3.5 on the client and .NET 4.0 on the server.  Both are included with the installation kits.

          • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
            Asle Frantzen

            Paul, thanks for the answer

             

            So far, we have extracted the scripts from the installer locally - and then emailed them to the DBA at our client. Sounds simple enough, but there always seems to be a problem. Sometimes the DBA forgets to create the local AFServers security group, sometimes that group doesn't have access to the SQL server, sometimes we have collation related issues (norwegian/danish collation), etc.

             

            The best thing would be an installer which creates the AFServers group, prompts you for the machine account of the server running the AF Service (or the domain account it runs under), creates the necessary SQL user, and also sets the correct collation (latin general ci as) for the PIFD database - before installing and announcing the successful outcome of the job

             

            But a specific follow-up question for your last statement: Since db_owner now would be sufficient - does that also mean that the DBA can create an empty PIFD database first?

              • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                pcombellick

                Asle,

                 

                I would recommend against local extraction then emailing of the scripts.  The file contains installation instructions.

                 

                Yes, the DBA can create the PIFD database first, which means they can set the collation and paths to the database files.  However, for AF to work correctly, the collation of the AF database must match the collation of the master and tempdb.  Infact, the DBA can create the PIFD database before running the full database install kit, also.

                 

                As you know, we have not figured out how to solve the norwegian/danish collation issue without refactoring all the AF app server and SQL logic in case sensitive mode.

                 

                The Windows local AFServers security group is not actually required and won't work when SQL Server is installed on a domain controller or on a cluster.  It is a convenience for the customer to be able to change the account that the af server runs as, without having to change the SQL Server security configuration.  The group is not useful when using SQL authentication to connect the AF App Server to SQL Server.

                 

                Regards,

                 

                Paul

                  • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                    Asle Frantzen

                    Steve, here's a small showstopper sometimes:

                     

                    When you install the AF application service and the AF database on separate servers, you can run the same setup kit for both operations. When running it on the database server, it still has .NET requirements even though this most likely is only required for the AF application service.

                     

                    The only thing required at the database server is running the scripts + setting up security settings. When the DBA's find out that some .NET framework is required they often say no, and we have to do the database part of the job manually.

                     

                    I suspect that the .NET requirement is only for the AF Service, and not for the database part of the install. If this is the case, please change it so that we can run setup kits on database servers without worrying about any requirements or more angry DBA's

                    • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                      pcombellick

                      Asle,

                       

                      Although you can extract the .sql scripts from the AF Server installer, on the Tech Support Download site, there is a separate download that contains the AF SQL Scripts: "PI Asset Framework (PI AF) 2010 R2 Database SQL Scripts".  This file contains a batch file and all the .sql scripts required to install or upgrade from a previous AF 2.x schema.  This file does not include an Windows Installer kit.  The .sql scripts can be audited by the DBA in order to verify the actions of the scripts.  This file does not contain any dependency on .NET.  The scripts use SQLCMD.exe and can be run from any machine that has the SQL Server client tools installed.  For AF 2010 R3, we have refactored this set of scripts to lower the privilege required to execute the bulk of the scripts to db_owner, instead of SysAdmin.

                       

                      Regards,

                       

                      Paul Combellick

                       

                      AF Dev

                      • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                        Asle Frantzen

                        We've made sure to add the installation instructions from the manual, and also customise them to fit our client's system. That includes making sure the db collation is Latin General CI AS.

                         

                        I didn't know that the collation had to match both the master and tempdb, I believed it was enough to set the correct collation for the PIFD database while installing it. We've had success by uncommenting these lines in the scripts for several clients:

                         
                        SET @CmdText = N'ALTER DATABASE [' + @dbName + N'] COLLATE SQL_Latin1_General_CP1_CI_AS';
                        PRINT @CmdText;
                        exec (@CmdText);
                        

                         In these cases the Sql Server had the norwegian/danish collation, but by uncommenting these three lines we were able to run all scripts without errors.

                          • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                            pcombellick
                            As you have discovered, the AF install script used to force the collation.  After much customer feedback, (except for Norwegian customers), we removed this statement. Your install scenario will probably succeed, but your customer will likely experience runtime problems in the future, depending upon which AF functionality they use.  In my experience, the collation of the PIFD, tempdb, and master databases must match otherwise you will see runtime "collation mismatch" errors.  If an AF collective is used (SQL Server Replication), the collations of PIFD, tempdb, and master databases on all the SQL Servers in the AF Collective, must match.
                          • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                            Asle Frantzen

                            Paul Combellick

                            As you know, we have not figured out how to solve the norwegian/danish collation issue without refactoring all the AF app server and SQL logic in case sensitive mode.

                             

                             

                            One more question/comment: Why would you have to refactor it in case sensitive mode? The collation we usually encounter is Danish_Norwegian_CI_AS, and CI here means the same as CI in Latin_General_CI_AS.

                              • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                                pcombellick

                                Agreed, the "CI" is supposed to mean "Case Insensitive".  Nonetheless, we still have problems with this collation as you have noted in TechSupport call#306060 that we do not know how to solve.

                                  • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                                    pcombellick

                                    It looks like this issue observed when using Danish_Norwegian_CI_AS collation is related to the case used in "DataAdapterName".  Apparently "aA" != "aa" but "aa" == "AA".

                                      • Re: Does AF SDK require .NET Framework 3.5 or 4.0?
                                        Asle Frantzen

                                        Yes, hopefully this will fix all our install / collation problems with the AF database.

                                         

                                        For those interested:

                                         

                                        [dataadaptername] and [DataAdapterName] should be the same when using a Case Insensitive collation, but it turns out that because of a few extra letters in the norwegian and danish alphabets some special cases are interpreted differently.

                                         

                                        "aa" and "AA" are the way to write our letter å / å on an english keyboard, so [dataadapter] has probably been taken as [datådapter]. Using a camel casing / Pascal casing where you get the "aA" is probably interpreted as the end of one word and the beginning of a new one, and is not translated.

                                         

                                        We also have two other characters, but I haven't seen any confusion about those with this collation:

                                         

                                        Lower case "ø" / upper case "ø" is commonly written as "oe", and "æ" / "æ" is commonly written as "ae" / "AE".

                                         

                                        Fun fact: The norwegian and danish keyboard layouts are pretty much the same, except where Norway has "ø" and "æ" after the ghjkl keys, Denmark has them switched around so it's ghjklæø