none
LightSwitch Project Builds failed RRS feed

  • Question

  • I have a complex localized LightSwitch Silverlight Application with Pixata Custom Controls (C#, upgraded Project from VS 2012 to VS 2012 Update 4), that builds on the local maschine.

    The LightSwitch Application contains WCF RIA Service Project (as dll created).

    The big problem is, that the solution cannot be build on the Build System (Build System configured as described in Microsoft document: How to Build LightSwitch Projects with Visual Studio TFS 2012 Team Build).

    Build Fails with the error:

    "C:\Builds\2\...\Project.ls3proj" (default target) (1) ->

    "C:\Builds\2\...\Project\Server\Server.csproj" (default target) (4:2) ->

    (LSCodeGenerators target) ->

      C:\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(253,5): error : Access to the path 'C:\Builds\2\...\Project\Server\GeneratedArtifacts\ApplicationDataObjectContext.cs' is denied. [C:\Builds\2\...\PersonalDigital\PersonalDigital\Server\Server.csproj]

    How can I make this to work?

    Please, help.

    Many thanks to LightSwitch Team.

    Thursday, February 13, 2014 2:44 PM

Answers

  • Hey guys,

    I could be mistaken and I'm not really experienced here, but I do think the GeneratedArtifacts folder should not be checked into TFS?  We have it listed in our tfignore file.

    Could you close your project, then from Source Control Explorer right-click on the folder, delete it, then check that in?

    I hope I'm not wasting your time since this isn't my specialty, but the folder and the artifacts inside should be generated by the LightSwitch build targets.  

    Best of luck

    Jan


    It's your story - time to switch on the innovation.||About me||LightSwitch blog

    • Marked as answer by AndySta Tuesday, March 4, 2014 3:11 PM
    Friday, February 21, 2014 12:49 AM
  • @Paul, 

    thanks for that insightful response!  Build servers, nor RIA services, are really my expertise, but I think I truly understand it now.

    By the way, Paul, if you have plans for this weekend, DO NOT READ ON. I'm going to throw a thought at you here but I know a great mind like yours will have a hard time finding rest afterwards ;-)

    The problem is this: during build, there is a certain file that needs to have it's 'read-only status' removed.  

    One solution would indeed be to modify the build process.

    In theory, the same result could be achieved by a custom MSBuild task.  This task would then become an inherent, yet reusable, part of every RIA service project, and one would not have to change the build process.  Since Nuget 2.5, such MSBuild tasks (target files) can be quickly distributed and installed via a Nuget package.  I happen to know a good Nuget package candidate for this as well.

    @Andy: sorry for hijacking your post. I have nothing interesting left to say, but I hope you guys find the solution to your problem asap!

    Keep rocking LS!

    Jan


    It's your story - time to switch on the innovation.||About me||LightSwitch blog

    Friday, February 21, 2014 4:08 PM
  • you are getting closer.

    Close your solution and open with the server proj file with notepad.

    search xap and you'll find an entry similar to:


    <_BuildFile Include="your xap">
          <SubFolder>
          </SubFolder>
        </_BuildFile>

    REMOVE this complete entry and check this in. 

    Probably your project was not a native V4 project, but migrated from V2 or V3, right?


    paul van bladel



    • Edited by Paul Van Bladel Tuesday, March 4, 2014 12:09 PM
    • Marked as answer by AndySta Tuesday, March 4, 2014 3:07 PM
    Tuesday, March 4, 2014 12:08 PM

All replies

  • Please could you try granting "Full Control" to "Users" for the folder "C:\Builds".  To do this, open the folder's Properties. Navigate to Security tab.  Click Edit... Select "Users".  Check the box against "Full Control" under Allow.  Let me know if this does not work...
    Thursday, February 13, 2014 4:50 PM
    Moderator
  • Thank you for the quick reply.  "Full Control" to "Users" for the folder "C:\Builds" allowed. The build runs longer.

    Unfortunately the same error:

    "C:\Builds\2\...\Project.ls3proj" (default target) (1) ->

    "C:\Builds\2\...\Project\Server\Server.csproj" (default target) (4:2) ->

    (LSCodeGenerators target) ->

      C:\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(253,5): error : Access to the path 'C:\Builds\2\...\Project\Server\GeneratedArtifacts\ApplicationDataObjectContext.cs' is denied. [C:\Builds\2\...\PersonalDigital\PersonalDigital\Server\Server.csproj]

    Please, please what can I do now?

    Many thanks!

    Friday, February 14, 2014 10:54 AM
  • Detailed build output can provide some clues.  Please could you set verbosity of build output to 'Diagnostic' as Dave describes here.  Please let me know what you find...
    Friday, February 14, 2014 4:56 PM
    Moderator
  • Please could you try deleting the contents in "Project\Server\GeneratedArtifacts" folder. From an elevated command prompt or Windows Explorer, navigate to this folder and delete all contents. Rebuilding the solution should regenerate these contents.
    Friday, February 14, 2014 5:35 PM
    Moderator
  • Thank you for the answer.

    We use snapshots on Build System. After restore of the snapshot the folder "Project\Server\GeneratedArtifacts" does not exists.

    Could the WCF RIA Service (use the ApplicationDataObjectContext.cs as the LightSwitch Application, too) be the problem?

    Please, can the LightSwitch Team help with an example of How to configure the LightSwitch Application that use a WCF RIA Service, so that the build on Build System work? It would be great!

    Many, many thanks!

    Monday, February 17, 2014 9:50 AM
  • Tuesday, February 18, 2014 7:00 PM
  • Thank you very much, Paul. I will try it.
    Wednesday, February 19, 2014 8:46 AM
  • I added a Process Invocation block to call the dos command Attrib on the files under the SourcesDirectory as in article "A solution for a caveat when building on TFS a LightSwitch solution with an internal RIA Service." described.

    Unfortunately the same error:

    Release | AnyCPU
    1 error(s), 15 warning(s)
    $/.../Project.ls3proj - 1 error(s), 15 warning(s)
    C:\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets (253):
    Access to the path 'C:\Builds\2\...\Server\GeneratedArtifacts\ApplicationDataObjectContext.cs' is denied.

    PS. Another LightSwitch TestProject (without WCF RIA Project) can build successfully on Build System, but if I add a WCF RIA Service to it, this will ends with the same error.

    Please, what can I do now?

    Can someone tell me, how to put this to working?

    Many, many thanks!

    Wednesday, February 19, 2014 1:23 PM
  • Hey Andy,

    could it be that you or a team member checked in the generated artifacts folder under source control recently?

    Thanks

    Jan


    It's your story - time to switch on the innovation.||About me||LightSwitch blog

    Wednesday, February 19, 2014 1:53 PM
  • the approach I described in the article, is working correctly on my side.

    Can you please verify, that the step you added (changing the file attribs to read/write) is effectively done, by checking the files on the build server (in other words are they all writable?)

    obviously, the step needs to be added before the build server starts building.

    paul.


    paul van bladel

    Wednesday, February 19, 2014 2:44 PM
  • Hey Jan,

    thank you very much for your contribution. I am the only one, who works by this project. My last CheckIn in the GeneratedArtifacts was at 11 February 2014.

    Please, have you another idea? I really appreciate any help.

    Wednesday, February 19, 2014 7:06 PM
  • Hey Paul,

    Thank you for your contribution. I added the process invocation before "Run MSBuild for Project", as in the article described.

    We have this "Run MSBuild for Project" two times and I add "Set ReadOnly Flags" for each "Run MSBuild for Project" call.

    Should be the Output Path for WCF RIA Service Project another as bin\Debug?

    As I described before, the WCF RIA Service Project (as dll added) is part of the Solution.

    Regarding the files on the build maschine (should be writable now): Please where should I look? Where is the SRC folder? Normally I have no authorization on the build maschine, I must ask our Administrator to have a look...  

    Many, many thanks.

    Wednesday, February 19, 2014 7:24 PM
  • put on verbose logging on your build definition (in advanced) and then you can see the path where the build server gets the sources for TFS. It's THAT folder that should have the read-only flags off.

    It's C:\Builds\2\...\Project\Server\GeneratedArtifacts\ApplicationDataObjectContext.cs

    You are using build agent 2, but the ... hide the full path :)

    Trust me, if you fix this, your build will work.

    If you want a temporary workaround, remove the file ApplicationDataObjectContext AS FILE LINK and add it again as a hard copy. Then the build will work also without the patch from my article.



    paul van bladel

    Wednesday, February 19, 2014 7:44 PM
  • Hey Paul,

    many, many thanks for help.
    I found the SRC folder:
    here is the full path:
    C:\Program Files\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(253,5): error :
    Access to the path 'C:\Builds\2\PersonalDigital\Personal Digital\src\PersonDigital\Dev\Sources\PersonalDigital\PersonalDigital\Server\GeneratedArtifacts\ApplicationDataObjectContext.cs' is denied. [C:\Builds\2\PersonalDigital\Personal Digital\src\PersonDigital\Dev\Sources\PersonalDigital\PersonalDigital\Server\Server.csproj]

    I want to use the solution from your article. So, I need your help again.
    Please, how should I put the Arguments(String)?

    At this moment I have:

    "/C attrib " + System.IO.Path.Combine(SourcesDirectory, "*.*") + "-R/S"

    and here is my bug, because the src folder have still read-only flags on. Please, how can I change this?
    Many, many thanks.

    Wednesday, February 19, 2014 10:14 PM
  • maybe your are not calling it on the right place. Did you correctly check in the adapted template?

    Please consult this sources for more info on how to customize the build template

    http://www.ewaldhofman.nl/post/2010/04/20/Customize-Team-Build-2010-e28093-Part-1-Introduction.aspx


    paul van bladel

    Thursday, February 20, 2014 5:08 PM
  • Hey Paul,

    thank you. I will try it.

    Thursday, February 20, 2014 5:58 PM
  • Hey guys,

    I could be mistaken and I'm not really experienced here, but I do think the GeneratedArtifacts folder should not be checked into TFS?  We have it listed in our tfignore file.

    Could you close your project, then from Source Control Explorer right-click on the folder, delete it, then check that in?

    I hope I'm not wasting your time since this isn't my specialty, but the folder and the artifacts inside should be generated by the LightSwitch build targets.  

    Best of luck

    Jan


    It's your story - time to switch on the innovation.||About me||LightSwitch blog

    • Marked as answer by AndySta Tuesday, March 4, 2014 3:11 PM
    Friday, February 21, 2014 12:49 AM
  • Hi buddy,

    You are completely right that the GeneratedArtifacts folder should NEVER be checked in.

    But, the problem is the ApplicationDataObjectContext.cs file. 

    When using a ria service which points to the intrinstic database, you will want to FILE LINK to the ApplicationDataObjectContext.cs from in the RIA project. By doing so, the domain model of the RIA service stays always in sync with the LS domain model.

    From the moment you make a file link, TFS will will automatically check in this file in the source location. So, the ApplicationDataObjectContext file does not exist physically in the RIA project, but will be checked-in in the generatedArtifacts folder. That's just TFS behaviour. Nohting do do about.

    My workaround is simple: On the build server make sure to simply change all file attribs to read/write AFTER TFS downloaded the sources, and BEFORE compilation starts. By doing so, it doesn't matter if there is that ApplicationDataObjectContext file in the generated artifacts folder, because msbuild can simply overwrite since it's no longer read only.

    This just works. The OP is struggling with adapting the build process template to incorporate the file attrib change invocation. If he fixes this, it should work, unless I have a magic build server :)


    paul van bladel

    Friday, February 21, 2014 9:05 AM
  • @Paul, 

    thanks for that insightful response!  Build servers, nor RIA services, are really my expertise, but I think I truly understand it now.

    By the way, Paul, if you have plans for this weekend, DO NOT READ ON. I'm going to throw a thought at you here but I know a great mind like yours will have a hard time finding rest afterwards ;-)

    The problem is this: during build, there is a certain file that needs to have it's 'read-only status' removed.  

    One solution would indeed be to modify the build process.

    In theory, the same result could be achieved by a custom MSBuild task.  This task would then become an inherent, yet reusable, part of every RIA service project, and one would not have to change the build process.  Since Nuget 2.5, such MSBuild tasks (target files) can be quickly distributed and installed via a Nuget package.  I happen to know a good Nuget package candidate for this as well.

    @Andy: sorry for hijacking your post. I have nothing interesting left to say, but I hope you guys find the solution to your problem asap!

    Keep rocking LS!

    Jan


    It's your story - time to switch on the innovation.||About me||LightSwitch blog

    Friday, February 21, 2014 4:08 PM
  • Jan,

    Wonderful !

    I know you do magical things with custom build tasks other  than down to earth setting file attribs read/write :)

    Love to hear more !

    Enjoy the weekend

    paul.


    paul van bladel

    Friday, February 21, 2014 4:57 PM
  • Thanks for help. Build LightSwitch Project on build machine cannot ends successfully.

    I removed ..\Server\GeneratedArtifacts folder. The build runs longer. The ApplicationDataObjectContext was added as hard copy.

    Now build failed with the error:

    (_CopyWebApplicationLegacy target) ->  C:\Program Files\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets(182,5): error MSB3030: Could not copy the file "Web\PersonalDigital.Client.xap" because it was not found. [C:\Builds\2\PersonalDigital\Personal Digital\src\PersonDigital\Dev\Sources\PersonalDigital\PersonalDigital\Server\Server.csproj]

    Please, what can I do now?

    Please, can someone help? I would realy appreciate!

    Many, many thanks!

    Tuesday, March 4, 2014 10:28 AM
  • P.S. The solution can be build local, on developer machine, the big problem is on the build Server.

    Many, many thanks.

    Tuesday, March 4, 2014 10:30 AM
  • you are getting closer.

    Close your solution and open with the server proj file with notepad.

    search xap and you'll find an entry similar to:


    <_BuildFile Include="your xap">
          <SubFolder>
          </SubFolder>
        </_BuildFile>

    REMOVE this complete entry and check this in. 

    Probably your project was not a native V4 project, but migrated from V2 or V3, right?


    paul van bladel



    • Edited by Paul Van Bladel Tuesday, March 4, 2014 12:09 PM
    • Marked as answer by AndySta Tuesday, March 4, 2014 3:07 PM
    Tuesday, March 4, 2014 12:08 PM
  • Hey Paul,

    many, many thanks for the quick answer.

    Yes, you are right. My project is not a native V4 project. This is above (just at the begin) noted.

    I followed your instruction AND IT WORKS. Build ends with SUCCESS on the build machine!

    You have saved my LightSwitch project and all my work.

    Many, many thanks once again.

    I don't ever forget you, as long as I live.

    Many, many thanks for all contributions regarding this problem.

    Who should mark this question as answer?

    Tuesday, March 4, 2014 1:30 PM
  • No problem, I'm very happy I could help.

    Just mark the relevant parts as answer, because you had 2 problems: the ria service and the xap thing.

    Indeed, integrating a project in a build pipeline is challenging :)

    Take care

    paul.


    paul van bladel

    Tuesday, March 4, 2014 2:20 PM