pnp / sp-dev-fx-vs-extension

Visual Studio extension work around SPFx together with community
MIT License
56 stars 25 forks source link

Error running project when connected to vsts #24

Closed joaosilva2313 closed 6 years ago

joaosilva2313 commented 6 years ago

Thank you for reporting an issue or suggesting an enhancement. We appreciate your feedback - to help the team to understand your needs, please complete the below template to ensure we have the necessary details to assist you.

Category

[ ] Question [x ] Bug [ ] Enhancement

Versions

[ x ] Visual Studio version (Help > About) [ ] SPFx Generator version (npm list -g @microsoft/generator-sharepoint)

Expected or Desired Behavior

When press F5, run the project

Observed Behavior

image

Steps to Reproduce

  1. Create Project
  2. Add To Source Control (VSTS + TFS)
  3. Check-in all files
  4. With this defined in workspace "Location: Server" image
  5. Run F5 got the error image

Submission Guidelines

Thanks for your contribution! Sharing is caring.

eshupps commented 6 years ago

If you look at what the build process is doing, it needs to update the [ProjectName].manifest.json file. But you have the file locked via the checkin, so it's seeing the read-only flag and throwing an access denied error. It is best to exclude files that are generated as the result of the build process from check-in. Other developers should generate output files themselves when they do a build or have them generated automatically during a team build. It's the same as adding the contents of /bin/debug or /bin/release to source control in a typical ASP.NET application - the build will fail because the files cannot be overwritten.

Have a look at the following project structure. This is a demo project that is also checked into TFS and doing automated builds on each checkin. Note the exclusion of certain folders. The contents of these folders will be generated when "gulp build" and "gulp package-solution" are run - they don't need to be (and shouldn't be) checked into TFS.

screen shot 2017-11-02 at 7 06 18 am
joaosilva2313 commented 6 years ago

Sorry for the late answer. I have the project configured like that image I can't run it, as soon as i change the Local Workspace, to Server. All the files in the "lib" folder get "read only" I can see you have that folder included, but should it be included?

eshupps commented 6 years ago

This functionality is "by design" when working with Visual Studio workspaces in Server mode. From the TFS docs at https://docs.microsoft.com/en-us/vsts/tfvc/decide-between-using-local-server-workspace:

When you are offline in a server workspace, you cannot work with your local files because they are read-only until you check them out. You can check out files only from Solution Explorer, and only after you switch to offline mode (as explained below). While you're offline, you can't perform any other operations, such as add, delete, rename, or undo.

Server mode is not designed for interactive file updates; rather, it is meant to emulate a "publish to IIS" type of experience. The Gulp task chain includes certain assumptions, one of which is updates to the manifest files during build and publish. This works best in Local mode. You can, of course, modify the Gulp tasks yourself but I don't recommend interrupting the chain of crucial file updates. Simply run in Local mode and it won't be an issue.

joaosilva2313 commented 6 years ago

Ok, thanks. I will start working with it on Local mode. Thanks for the help and great job on the template, just installed the new version 1.3.3