How to include third-party code in separate versions in one project

I have an interesting problem on hand, and I can’t figure out how to handle it properly. This is typical of sitecore, but I would suggest that the fix would be one that can be applied to anyone who has several websites that run different versions of the framework.

Right now I have 3 separate websites that run Sitecore as a framework and CMS for sites. On one website, it runs the code from Sitecore 6.5, the other at 7.0, the other at 7.0, and 7.2 will suffice.

One of the basic principles of programming is not to repeat it yourself. I want to create a separate C # project to enable the processing of specific Sitecore logic and classes. Basically, this will include utilities such as classes that perform simple functions to make it easier for me to check many things. These basic features are included in every version of Sitecore that I use.

Basically, there are many common functions between Sitecore DLLs, despite the differences, and I want to be able to write agnostic version code in one place.

I don't care if I need to create three separate DLLs for each set of Sitecore DLLs with which I need to compile while I can save one base source. Is it possible?

+2
source share
1

:

/. .NET-, , , SC, , , , API .. , , - UIFilterHelpers.ParseDatasourceString ( 7.2 SearchStringModel.ParseDatasourceString). , , :

#if SC7
    IEnumerable<SearchStringModel> searchStringModel = UIFilterHelpers.ParseDatasourceString(Attributes["sc_datasource"]);
#else //SC72
    IEnumerable<SearchStringModel> searchStringModel = SearchStringModel.ParseDatasourceString(Attributes["sc_datasource"]);
#endif

partial ( . , :

  • Common.sln
    • Common.SC65.csproj
      • MyClass.cs [shared]
      • MyClass.SC65.cs
    • Common.SC7.csproj
      • MyClass.cs [shared]
      • MyClass.SC7.cs
    • Common.SC72.csproj
      • MyClass.cs [shared]
      • MyClass.SC72.cs

MyClass.cs . , .SC#.cs , sitecore.

, .NET . MVC, MyProject.csproj, MyProject.MVC3.csproj, MyProject.MVC4.csproj, MyProject.MVC5.csproj ( , , ).

+3

All Articles