As You Like It was likely written between 1598 and 1600. It was entered in the Stationers' Register on August 4, 1600 but no edition followed the entry, thereby leading to the ambiguity in its publication date. Two topical references have been used by scholars to claim 1599 as the date of writing, but even this is inference only. For instance, Francis Meres, a contemporary of Shakespeare, listed the plays known to him in September of 1598 and did not include As You Like It among them. The first known publication is in the 1623 First Folio, taken either from Shakespeare's promptbook or less likely from a literary transcript of the promptbook.
The source for the plot of As You Like It is derived from Thomas Lodge's extremely popular prose romance Rosalynde. Written in 1586-87 and published in 1590, Shakespeare knew the story quite well although he changed a great deal of the details and emphasized different things. Lodge for example did not have ducal brothers, but Shakespeare chose to make enmity between brothers central to the theme of the play. Shakespeare also chooses to make primogeniture a target of his criticism by allowing Oliver to inherit everything, whereas Lodge had an equal inheritance between the brothers in his version. The clown Touchstone and the melancholically satirical Jaques are also both creations of Shakespeare.
The Forest of Ardenne is from Lodge's romance, and actually describes an ancient woodland comprising parts of France, Belgium and Luxembourg. Shakespeare used the French setting through his choice of the French spelling, "Ardenne". However, the First Folio indicates another spelling, namely the Forest of Arden, an Anglicized spelling that also corresponds to a forest near Shakespeare's birthplace in Warwickshire. This happy coincidence is indicative of the doubleness in the play; although set in a foreign kingdom the play refers to English customs such as Robin Hood and primogeniture. Thus the play can deal with problems at home in spite of its seemingly foreign setting.
The story of Orlando and Oliver comes from another source, that of The Tale of Gamelyn, a Middle English story in which a younger brother seeks revenge on an older brother who mistreats him. This story invokes the name of Robin Hood, the famous English outlaw who lived near Nottingham and poached the king's deer. Indeed, the opening scenes of As You Like It invoke the image of Robin Hood when Charles the Wrestler describes Duke Senior as a modern day Robin Hood with his band of nobles around him.
As You Like It finds its origins in the pastoral tradition of the Renaissance in which the rustic field and forest provides a sanctuary from urban or courtly issues. The play itself takes place in a forest where the characters are hiding from treachery at court or injustice in the family. This pastoral tradition began with Theocrites in ancient Greece, whose writings explored the sorrows of love and daily injustices in a rural setting. Virgil expanded the tradition, emphasizing the distinction between urban and rural lifestyles even more. Renaissance literature focused more on the distinction between court and country life, and Shakespeare had many contemporaries who worked in this literary vein, including Edmund Spenser who based his Shepherdess Calendar in 1579 on Virgil's Eclogues, and Sir Philip Sidney who wrote a romance in 1590 titled The Countess of Pembroke's Arcadia.
The pastoral tradition, in spite of taking many literary forms, conformed to a traditional set of rules. A typical story would involve exiles from the court or city going into the countryside and living either with or as shepherds. While in the rural area, they would hold singing contests and philosophically discuss the various merits of both forms of life. Eventually the exiles would return to the city having resolved their particular problems.
Pastoral works have most frequently been used as social criticisms due to their ability to question the natural world versus the artificial manmade world. The characters often discuss whether life in the country is preferable to that of the city, usually focusing on such evils as cruel mistresses or the dishonesty of courtiers for themes. The simplicity of the countryside is always celebrated in a highly artful manner, imitating the Western literary tradition as it has developed over time. Indeed, the pastoral genre provides authors with a way to pretend; the characters immerse themselves in another world and can act out their ideal worlds. Thus in this "simplistic world" we see many disguises where courtiers pretend to be shepherds, men dress as women, women dress as men, and nobles become outlaws. The pastoral world gives its cast an opportunity to alter their own world when they return through the games they play in this contrived, imaginary location.
Shakespeare adopted the pastoral as a chance to deal both humorously and seriously with his two themes of brotherly betrayal and doting love. Indeed, the play has more songs in it than any other Shakespearian drama, a sign that Shakespeare enjoyed the pastoral genre he was using for the play. The forest of Ardenne, where the characters all end up, turns out to be very similar to other forests: it causes fear through the wild animals but provides the right atmosphere for healing to occur. This corresponds closely to the forest in A Midsummer Night's Dream where most of the action occurs before the cast returns to Athens with their problems resolved. Indeed, after hunting deer, tending sheep, singing songs and writing love sonnets on bark, most of the cast in this play returns home again with all their problems solved.