locked
Unable to deploy a second LightSwitch project in the same solution? (2-tier) RRS feed

  • Question

  • I've trying to create a single solution that will house multiple LightSwitch projects.  However, it seems that trying to have 2 applications in one solution disallows publication of the second project?  I am using LightSwitch 2011, and process below and quite easy to recreate...

    Create new LightSwitch project
    Attach to external Data Source - pick a table
    Set Access Control to "use Windows authentication"
    Build application
    At solution level - configuration manager - change solution configuration to "release"
    Publish application -
      leave as desktop,
      local app server,
      publish directly to database now,
      point database connections to external sql server,
      create application administrator

    Publish should succeed

    Change configuration manager of solution back to "debug"

    Add a second LightSwitch project to the existing solution
    Follow all previous steps to create an identical setup to the first project:

    Attach to external Data Source - same table as before
    Set Access Control to "use Windows authentication"
    Build application
    At solution level - configuration manager - change solution configuration to "release"
    Publish application -
      leave as desktop,
      local app server,
      publish directly to database now - pick same database as previous project
      point database connections to external sql server,
      create application administrator - same account as before
     
    Publish fails with "The password supplied is invalid.  Passwords must conform to the password strength requirements configured for the default provider."

    Best I can tell the web.config doesn't pick up that this is windows authentication and wants to use a user/pass credential when trying to talk to the repository database??

    Remove the first project that publishes successfully from the solution.

    Publish second project, now by itself in the solution.

    Publish should succeed.

    ----------

    Thoughts? Am I doing something incorrect with this simple scenario?

    Wednesday, March 20, 2013 5:39 PM

Answers

  • Justin - yes, by "intrinsic" database I mean "Add Table" instead of adding or attaching to a "data source".

    I wasn't able to repro the issue in VS2012 which I realize may not help you much...

    In LightSwitch 2011 I could repro, but only once.  After my repro, I unloaded the project that I was not publishing, published successfully with Auth enabled and then reloaded the other project.  After that I could publish with both projects in the solution, even creating the admin user.

    It looks like that might be a workaround for you in the short term - unload projects that you're not publishing or seem to be interfering with the publish.  If you have a lot of projects in the solution that's probably a bit of work, but we'll have to dig some more to see if there's a better solution.

    HTH

    Monday, April 1, 2013 6:43 PM
    Moderator
  • LightSwitch 2012 is part of Visual Studio 2012 which is a released product. There will not be a separate, stand-alone version of LightSwitch 2012.

    The HTML Client for LightSwitch is still in beta and is expected to be released in Visual Studio 2012 Update 2.


    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    Tuesday, April 2, 2013 1:03 PM

All replies

  • Having more than one LightSwitch project in a solution is not a "supported scenario", as far as I know.

    That said, I can't see why it wouldn't work, but you can only have one of them "active" at any particular time. If I was doing this, I'd make sure that I made the one that I wanted to publish the "Start-up project" before I published it.

    You won't get both projects publishing at the same time, just in case that's what you were expecting.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, March 21, 2013 4:40 AM
    Moderator
  • I think this is not a supported scenario because a LightSwitch "project" is actually a LightSwitch Solution, already containing three Projects (Client, Server & Common). The HTML client UI adds a further Client Project. Perhaps when the HTML Client software is released to manufacturing we will be able to add multiple Client Projects targetting either LightSwitch or HTML but, at the moment, it appears you can have just one of each.

    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    Thursday, March 21, 2013 9:58 AM
  • Thanks for the responses!

    A little more information:  I'm only trying to deploy one project at a time, and I don't expect that to change.  Really what I want to do is use the solution as an organizational tool to hold disparate but related LightSwitch applications.

    I've also noticed that this particular issue/restriction/bug is related to trying to add the administration user.  If I publish by itself to get the admin user and then subsequent publications while both projects are in the same solution succeed just fine.

    Simon,

      I've noticed those Client,Server & Common projects that you mentioned - it appears that there are two "versions" of each of this but that the solution dependencies are smart enough to associate the correct LightSwitch app with the correct version of these.  This was actually one of the things that led me to believe this was a bug rather than a restriction.

    So, I don't need these guys linked or be able to "publish all", I just wanted them all in the same place and be able to add a new application without going through the trouble of creating a new solution each time, linking it to source control, etc - is it documented somewhere that we can't have multiple LightSwitch apps in the same solution?

    Thanks,

     Justin

    Thursday, March 21, 2013 12:07 PM
  • For an organisational tool to contain several LightSwitch Solutions I would look to using a Team Foundation Server Project.

    That will let you organise your Source Code properly into folders, share the Source Code with other developers and give you a whole lot more.


    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    Thursday, March 21, 2013 12:43 PM
  • Actually, that's not quite true. A LightSwitch project isn't really a "LightSwitch solution", it's a special project type that has a number of sub-projects.

    The actual solution that contains the LightSwitch project can have other types of projects added to it, such as a class library for a RIA service, or a class library of utility methods.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, March 21, 2013 2:30 PM
    Moderator
  • So keeping that in mind along with the fact that I can publish either project just fine if I'm not trying to create the admin user is it still "wrong" to have two LightSwitch projects (each with their respective sub projects) in a single solution and want to publish either on it's own?

    Simon - we actually use TFS, but we try to limit our solutions as much as possible by using multiple projects if they are related.  As Yann eluded to, we do this for class libraries and I can imagine multiple LightSwitch Projects needing to reference the same class library, and for us each of these apps will me maintenance of data that's flowing into a warehouse - so it made sense to try to gather all those very similar apps together.

    Thursday, March 21, 2013 2:41 PM
  • Justin just to make sure I'm following where you're at...

    As long as you don't try to create the admin user during publish, publish of either projects succeeds ok?  If so, is it possible to use the security admin tool to create the admin user post publish?

    …\Program Files\Microsoft Visual Studio 10.0\LightSwitch\1.0\Tools\Microsoft.LightSwitch.SecurityAdmin.exe/createadmin /user:MyAdminUser /password:strong#Password /fullname:Admin /config:c:\....\web.config

    Aside from that, having to LS projects in the same solution should be ok, I think you just hit a bug (and there may be more) but it wasn't something we intended to exclude support for...

    HTH

    Thursday, March 28, 2013 9:31 PM
    Moderator
  • Hi Brian,

      Thanks for the update that I'm not doing anything off-the-wall.  You are correct with your interpretation - I can publish just fine if I'm not trying to create an Admin user.

    Using the SecurityAdmin.exe seems to get the same result:  "The password supplied is invalid".  It's possible that I'm doing something incorrectly but it seems like the web.config is giving the same arguments to SecurityAdmin as the publish command in the IDE?

    My command line is slightly different from yours because I'm doing integrated and don't have the password, but perhaps I didn't do it correctly:

    Microsoft.LightSwitch.SecurityAdmin.exe /createadmin /user:MLKNNTP0\CSJCC /config:"F:\TFS\Data Warehouse\DirectEntryApplications\DirectEntryApplications\Development\SubscriptionConfig\bin\Debug\web.config"

    Happy to try any other steps you might have.

    Monday, April 1, 2013 1:01 PM
  • Justin - you're right that the parms the securityadmin.exe uses are the same coming from the web.config - I was guessing/hoping that using it outside of publish would make a difference.

    Can you clarify one thing for me?  Do any of the projects that fail have an intrinsic database?  I noticed in your steps above you attach to data, but do you create any with the app?  If not, can you try creating a dummy table to be published with the app an see if that makes a difference?

    LightSwitch is using the intrinsic database for the asp.net membership info for the auth.  It's possible those tables aren't getting created properly (we've seen issues with that in the past)...

    Monday, April 1, 2013 3:17 PM
    Moderator
  • Both projects in my solution currently just have a single datasource and a single EditableGrid screen, though I think with my example that started this post I didn't even go as far as creating a screen.

    By "intrinsic database" did you mean adding a table to the project?  I right-clicked on the project and hit "Add Table" which created an ApplicationData Data Source and a table under that heading.  After rebuilding the project it blows up with the same error.  I did however note that my new "Table1Items" table was added to the LightSwitch "repository" database (not sure the correct term in this context) - the guy that has aspnet_Applications, aspnet_Membership, etc. that I point to when I publish.  The other tables where created from my first successful publish of the first application in the solution.

    Please note these tables do not have any information about my second Application because of the failure so that part of the publication doesn't happen.  As far as I can tell in those tables the second application does not even exist.  I assumed this was because the first entries for an app are created when the publish creates the admin account and subsequent records come from the application's security screens...at least that's what I assumed because I have published the application without creating the admin account successfully and there's nothing in these tables afterwards.

    Monday, April 1, 2013 3:32 PM
  • Justin - yes, by "intrinsic" database I mean "Add Table" instead of adding or attaching to a "data source".

    I wasn't able to repro the issue in VS2012 which I realize may not help you much...

    In LightSwitch 2011 I could repro, but only once.  After my repro, I unloaded the project that I was not publishing, published successfully with Auth enabled and then reloaded the other project.  After that I could publish with both projects in the solution, even creating the admin user.

    It looks like that might be a workaround for you in the short term - unload projects that you're not publishing or seem to be interfering with the publish.  If you have a lot of projects in the solution that's probably a bit of work, but we'll have to dig some more to see if there's a better solution.

    HTH

    Monday, April 1, 2013 6:43 PM
    Moderator
  • Apologies, didn't get a chance to get back to this yesterday.

    I can confirm I'm seeing the same functionality.  With VS2012 not having the problem and only needing to unload (first time I've ever had occasion to use that) for the initial publication I think this is a totally viable workaround.

    As confirmation, there isn't a "released" version of LightSwitch 2012 yet, right?

    Thanks for the help!

    Tuesday, April 2, 2013 12:17 PM
  • LightSwitch 2012 is part of Visual Studio 2012 which is a released product. There will not be a separate, stand-alone version of LightSwitch 2012.

    The HTML Client for LightSwitch is still in beta and is expected to be released in Visual Studio 2012 Update 2.


    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

    Tuesday, April 2, 2013 1:03 PM
  • @Justin - I'm glad you're able to "confirm the bug" - I much prefer it when software behaves logically...  Sorry for the need to work around though.

    Also, Simon is correct that there is no standalone version of LightSwitch for 2012 - Going forward LightSwitch will be part of the VS SKUs.

    The HTML Client release of LightSwitch went out with CTP4 of VS Update 2, you won't see any functional changes between CTP4 and RTM of VSU2.  So it's safe to jump in if you're anxious :)

    Tuesday, April 2, 2013 2:50 PM
    Moderator
  • So I must have missed that in my research that LightSwitch 2012 was baked into VS2012.  It was, admittedly, not a whole lot of research before I just dove in.

    With just starting out I think I can just move entirely to 2012 and everything should be fine.  Overall this worked out well - workaround for 2011 and verification that 2012 doesn't have the issue.

    Thanks for everyone's assistance.

    Tuesday, April 2, 2013 5:11 PM
  • "It looks like that might be a workaround for you in the short term - unload projects that you're not publishing or seem to be interfering with the publish"

    @Brian - that's actually a very good suggestion, allowing Justin to still keep a number of projects together in one solution, but get them out of the way if he doesn't need hem, or if one causes a problem.

    I've used this method for quite a while now, for exactly that reason, to keep related projects available in one solution, unloading anything I'm not directly working on, but might need to get to quickly. I'm kicking myself that I didn't think to suggest it myself, lol.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Wednesday, April 3, 2013 12:08 AM
    Moderator