I’ve been demo-ing a project on Azure and happily publishing the project to a couple of different Azure sites during the testing phase. The time came a couple of days ago to publish to a package which I could deploy on the client’s server, which worked fine as well. But then I wanted to update the Azure site again and suddenly got an error – “The following exception was thrown trying to publish: Sequence contains more than one matching element”
Some searching got me to this post by Dave Kidder. I found that the settings he mentioned were in the .ls3proj file rather than the .lsproj file (probably a feature of Lightswitch v3) but his fix did get publishing working again. Unfortunately it also broke the authentication on my debugging copy of the project such that Test User could no longer access anything useful.
That was probably caused by deleting the .user file but the whole approach seemed a bit brute force so I decided to take a closer look at what actually needed to be changed to fix the error. Comparing the .ls3proj files from before and after publishing to a package, I found only two relevant changes.
had been added. Changing False back to True and deleting the DefaultDatabaseName property got publishing back on track and the project still works under debugging.