Skip to content

Compromise for disconnected dev model #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
david-poindexter opened this issue Jun 29, 2018 · 20 comments
Open

Compromise for disconnected dev model #16

david-poindexter opened this issue Jun 29, 2018 · 20 comments

Comments

@david-poindexter
Copy link
Contributor

Instead of providing a way for people to develop inside of a DNN instance, I highly recommend documenting the use of symbolic links via Microsoft's built-in Windows 10 command mklink. Once the module is "installed" the first time, from there, you could just develop where you want and use MKLINK to map files to the appropriate directories.

@mtrutledge
Copy link
Owner

mtrutledge commented Jun 30, 2018 via email

@mtrutledge
Copy link
Owner

So I would essentially need to find out where their local DNN instance is installed and then run a command like?

mklink /d D:\WhereverProjectIs\ C:\inetpub\wwwroot\DotNetNuke\DesktopModules\CompanyName\

@david-poindexter
Copy link
Contributor Author

Yes, you would also need to link the DLL(s) if applicable.

@SkyeHoefling
Copy link
Contributor

This is exactly what I do and I find it very helpful for rapid development. A couple things that you should really be careful with this:

  • Run the mklink command for the dll(s) in the bin directory. I strongly recommend running the command for the pdb so you can get debugger support
  • Run the mklink link for the views (cshtml) directory
  • mklink and IIS don't play nice, even if I am updating cshtml code I find myself running iisreset

@david-poindexter
Copy link
Contributor Author

Great points @ahoefling - with SPA approach we typically don't have the IIS issue though.

@SkyeHoefling
Copy link
Contributor

I have been putting some more thought into this and I have come up with a new solution that I think will be really benefit this project. I have added several new gulp tasks that handle a basic local deploy

  • Copies .dll and .pdb files to the bin directory of a local dnn site
  • Delete the Views folder and copies all files recursively from your dev code into your module in DNN

After initial testing this appears to be working and resolves the issues I highlighed above with MKLINK and requiring iisreset while even updating views.

This doesn't come with a trade off, which I hope we can discuss alternatives and come up with a good solution.

  • The gulp script now relies on the location of a local DNN instance

If anyone wants to try out the scripts let me know and I can post them in this thread

@david-poindexter
Copy link
Contributor Author

@ahoefling it would be great to have a gulp command to set the DNN instance path. That would make it easy to switch sites. We usually test on multuiple DNN versions during development. Worst case, the DNN instance path should be stored in a simple JSON file within the project.

@mtrutledge
Copy link
Owner

mtrutledge commented Jul 25, 2018 via email

@SkyeHoefling
Copy link
Contributor

The problem with using the DNN Installer regardless of how we invoke it (DnnCli, etc.) is we need the .PDB files to be shipped into the bin directory. I'm not sure if the DNN installer framework would handle copying over the pdbs unless we specified them in the dnn manifest file.

The idea here is for development, not deployment. As a developer I am going to manage the database myself so it is okay to not run the sql scripts as part of these gulp tasks. The important thing is I need my dlls and pdbs in the bin directory. I need any static content I have created to be copied into my module folder

@mtrutledge
Copy link
Owner

mtrutledge commented Jul 25, 2018 via email

@SkyeHoefling
Copy link
Contributor

I like this idea a lot but I think we need create a few different commands here to facilitate different development environments:

  • npm run start
    • full lifecycle like you mentioned above
  • npm deploy
    • Detects if module has ever been installed. if not run execute the following steps
      • Run npm package to build installer
      • Run the dnn installer using something like DnnCli
      • at this point it will be safe to side load everything else
    • Copies dll,pdb, and any other module files over to correct directories (side-load)
  • npm debug
    • Runs npm deploy
    • Starts http://dnndev.me in the default browswer
    • Maybe it would attach a debugger? This is more for visual studio integration, probably not a good idea for npm
  • npm watch or npm debug watch (whatever is the best convention)
    • Runs npm debug
    • added the necessary watch for all the copied files so you don't need to constantly run npm debug or npm deploy (there is a gotcha to this that I will document below under MSBUILD)

MSBuild Issues

Looking through the proposed build tasks above there is an issue with the npm watch and the concept of updating the files on the server as they are changed. How do we update/generate the dll/pdb files?

  • typically this is done via MSBuild

This really doesn't fit into the gulp task architecture IMO so adding the watch for the dlls and pdb isn't really useful. Unless the idea is to just copy over the dll so the app can get the latest code.

What I think we should do is build a visual studio integration with gulp which just requires a gulp directive at the top of the gulpfile.js.

  • When the user runs a build from visual studio after completing it should run the npm debug or npm deploy.

Following this pattern for msbuild now allows the user to build their code and deploy it easily with 1 button click in visual studio. They will then be able to attach their debugger to the code.

IMPORTANT

We can't attach the debugger to a pdb/dll file that was built from gulp that needs to happen by visual studio or the debugger will think it is not user code.

@mtrutledge
Copy link
Owner

mtrutledge commented Jul 25, 2018 via email

@SkyeHoefling
Copy link
Contributor

Okay that makes sense on how the watch works as I don't have much experience in that. While msbuild is running via the command line there is an issue with the PDB that are being generated. This is a problem I ran into the other night when I was writing these tasks. When I tried attaching to a pdb that was generated by the gulp task I couldn't. I could only attach to the pdb/dll that was generated by visual studio.

I may have a bad configuration but I am reporting the behavior that I have seen in the field when testing these ideas out

@mtrutledge
Copy link
Owner

mtrutledge commented Jul 25, 2018 via email

@SkyeHoefling
Copy link
Contributor

what is the benefit of having the gulp task generate the dll/pdb in this scenario? Unless I missed something you really can only debug this with visual studio

@mtrutledge
Copy link
Owner

mtrutledge commented Jul 25, 2018 via email

@SkyeHoefling
Copy link
Contributor

This makes a lot of sense and I see where you are coming from now.

I did a quick search and I think I found something that may be helpful in our research. It appears there is full .NET Framework debugger support in VS Code (I had no idea). The problem is you need to specify your PDB as portable. My guess is we aren't passing that in the msbuild arguments like you mentioned above.

Take a look at this thread which I found helpful in this topic

dotnet/vscode-csharp#813

@mtrutledge
Copy link
Owner

mtrutledge commented Jul 25, 2018 via email

@david-poindexter
Copy link
Contributor Author

@mtrutledge and @ahoefling just a thought here - we don't use dnndev.me - we use custom local URLs, so having a way to use those would also be helpful.

@mtrutledge
Copy link
Owner

mtrutledge commented Jul 26, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants