Can a Web App project and a Cordova Hybrid App project share common code in a single VS2013 solution? - visual-studio-cordova

Ideally, we'd like to create a single VS2013 solution that contains two projects. One project is a web/browser based version of the application and the other is our hybrid app version that will run on an android tablet. For now, it's a simple app with no dependencies on any cordova plugin. All we have is some JS, HTML and CSS so either target should be viable with the same common code.
We are successful if we make a separate solution/project for each type and pull the related scripts, css, and html from a common repo but this is less than ideal since we still have two distinct solutions/projects for the same shared code.
We've tried using symbolic links in the hybrid project back to the existing items in the web project but these items don't get copied to the hybrid bld folder when you build the hybrid app.
If anyone using the VS2013 cordova tools is facing a similar challenge, I'd like to know how you're handling this scenario.

Related

Further opportunities with an ASP.NET Project?

I recently finished a personal web application I had created for my uni. It's mine now to do with as I want. I wrote it on Visual Studio using ASP.Net, CSS, and C#. (I had originally written the first few pages in HTML and PHP, but due to a problem with my computer's inability to run XAMPP, the PHP pages weren't running as required so I redid it on Visual Studio)
The project's initial functionalities (uploading media and documentation, and login and user registration) are there and the pages work, and I plan to proactively work on it to add more features and make it more dynamic and versatile.
However, I have a question, what can I do with it now? Is there a platform (maybe Stackoverflow itself?) that I can upload the project as a whole on to add it to my technical portfolio? or maybe another such action I could do to upload or publish it to add it to my list of things done as a reference for recruiters, or as part of my project history for graduate school?

Angular + ASP.Net Core : Plugin Architecture

I am trying to build an Enterprise System that will evolve over time with features being added as time progresses.
I am planing to go with ASP.Net Core microservices architecture with Angular for the UI. I am unable to find a sample that shows how we can introduce new modules without changing any existing angular code.
I was able to do this in the traditional winforms applications using technology like MEF and dropping the dll in to a folder that shell watches and loads.
Looks like there is no such example using the Angular framework. So I was curious if its even possible to achieve an architecture as shown below?
Module are the asp.net core services that serve the angular files that the shell can render and Service are the logic services that are used by the applications themselves.
I did see this post, that is close to what I want to do, but I am not sure if this is even the right solution being discussed.
Any pointers appreciated.
I tried to implement a plugin architecture making use of ABP, Angular and ASP.NET Core: https://github.com/chanjunweimy/abp_plugin_with_ui
Basically, I developed angular plugins using different angular application, then I dynamically add them together.
More Information on how I achieve it:
I have 2 angular-cli application, 1 is the main angular cli application, and another is the plugin angular cli application. The problem we are facing in Angular-cli plugin architecture approach is how we integrate them.
Right now, what I did was, I run ng-build on both of the applications, and put them into a "wwwroot" folder, which then hosted in a ASP.NET core 2.0 server.
abp_plugin_with_ui is a repository which works on developing a plugin which contains both the backend and Angular cli. For the backend, I made use of the aspnetboilerplate framework, which the frontend is developed using multiple angular-cli application.
To have the main application integrated with the plugin application, we have to run "ng-build" on both of the application (note that we have to change to href of the plugin application as well), then we move the built contents of plugin angular cli application, to the main application "wwwroot" folder. After achieving all this, we can then run "dotnet run" to serve the ASP.NET Core 2.0 Web Application to host the static files generated by "ng build". In this approach, plugin Angular UI applications are independent from the main Angular UI application: they are connected using IFrame.
Recently, I realized that we could create components on the fly, which means that maybe it is better to download the "NgModule" and create that module dynamically instead. This option is better because plugins UI would directly integrated into the main application UI. I am still trying out this method.
Another option suggested by #bruno was to develop the UI in SOA instead. This means that, we could choose not to separate the UI into plugins, but separate them into modules as independent service instead. You need to have a so-called "IT/Ops Client" that could help you manage what view to show in the UI, and the main UI is just a frame/template that will show what "IT/Ops Client" want to show. Using this way, we could register these services, and chose what service to be used. This is the microservice architecture and might be closed to what you want. The microservice expert Udi Dahan has a post blogged about this (link: http://udidahan.com/2014/07/30/service-oriented-composition-with-video/)

Simplifying publishing multiple ASP.NET Web Site Projects in VS2008

I have a solution in Visual Studio 2008 that contains three projects: a C# Library and two ASP.NET Web Sites (call them A and B). Web Site A depends on the library, and Web Site B depends on Web Site A.
This means that if I make a change to the library project, I have to build it, then publish A, and then publish B. Similarly, if I change A, I have to publish it and then publish B in order to push my changes through.
Is there any way to make this a one-click process for the entire solution? Basically I'm just looking for a way to, in one opaque step, build the library, build/publish A, and then build/publish B.
I have looked into the Web Deployment Project option and it does not do what I need - as far as I can tell, it kind of does the opposite (highly customized build & deployment for a single web site, rather than pretty much default-config building/publishing for multiple projects all at once).
I believe that Web Deployments projects will work for multiple projects within the same solution.
http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx
If you look at his examples, you can see that he has a website project or WAP as well as a C# library within the same solution, and he seems to be able to compile and deploy them all together.
You could probably also use multiple WDP within the same solution configued to do multiple things.
Basically the best way is to forget clicks and make this single-step deployable from the command line. Check out MsBuild to build the solution, then possibly the aspnet_compiler for build/deploy usage.

web application projects v.s. web site projects [duplicate]

This question already has answers here:
ASP.NET Web Site or ASP.NET Web Application?
(25 answers)
Closed 9 years ago.
I am reading from the following link,
http://reddnet.net/code/asp-net-web-site-vs-web-application-project-part-2/
My two confusions,
What is the so-called issue "No control over your namespaces" cons from a web site project? Could anyone show me a sample to illustrate this issue please?
What is the so-called issue "It is hard (read, nearly impossible) to reference pages, user controls, etc from custom classes in the app_code folder."? Could anyone show me a sample to illustrate this issue please?
I am using VSTS 2008 + .Net 3.5 + C#.
thanks in advance,
George
imagine a WebSite...
that is a simple web app, all alone in the world... remember, you can't add anything else to it, right...?
Now, how about a web project? that it's part of a Solution, and a Solution can have n projects, take my current work for example:
alt text http://www.balexandre.com/temp/2009-06-29_0816_so_question.png
In just one solution, I have more projects than the website, and even if they are in different directories I referenced those projects in the website and it's easy to edit, for example, the ExtensionMethods project when I need to add more.
This is something that you can't control in a WebSite, only in a Web Application Project.
The Web Application Project is like any other project, it includes all files that are in Projects like the proj extension file, and it's treated like a project, for example, you can exclude files to be compiled (you can't in a Website), it is easier to deploy because of the nice plugin called Web Deployment Project", just right click in your WebSite project and choose Add Web Deployment Project...
alt text http://www.balexandre.com/temp/2009-06-29_0825_soanswer.png
And you can deploy only this project (add it to your Web Setup, in order to create the msi file) and you will deploy a compiled website (no source code is showed, all code is compiled into dll's so you can hide the source).
There are numerous advantages to use Web Application Project over a simple Website...

Web Site or Web Application in ASP.NET

Which Visual Studio template should be used for a ASP.NET web site, the Web Site template or the Project | Web Application template?
you'd better read this:
http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx
in my opinion it depends on what you are developing
Both function and perform similarly, but still differ in following ways:
Web application:
We can't include C# and VB pages in single web application.
We can set up dependencies between multiple projects.
Can not edit individual files after deployment without recompiling.
Right choice for enterprise environments where multiple developers work unitedly for creating, testing and deployment.
Web site:
Can mix VB and C# page in single website.
Can not establish dependencies.
Edit individual files after deployment.
Right choice when one developer will responsible for creating and managing entire website.
Web application projects works more like a traditional VS project, which has a project file, is compiled in one step and so on.
Web site projects works more like classic ASP or PHP-sites. There is no project file (references are stored in the solution file), and pages are recompiled dynamically on the server. The nice thing with web sites is that you can just ftp to the server and change a file in a text editor. You dont need VS. Some may hate that, though.
It probably depends on your background. If you are used to ASP or PHP style development, web site projects will seem more natural to you. If you have a traditional application developer background, web application projects will seem more natural.
If you're using Team Foundation Server for source control, you'll probably have to use a Web Application Project, as you need a .csproj file.
There are more details from Jeff Atwood himself: Web Site Projects vs. Web Application Projects
Web Site web projects are particularly painful in Team System due to the lack of a physical file that contains project information and metadata. For example, it's impossible to check in code analysis rules on Web Site projects, because the code analysis rules are stored entirely on the client!
I prefer a website. A website is a collection of files in a directory. It becomes more portable and deployable. A web application clouds the issue with a project file.
Personally I use web application projects exclusively now. I actually converted a rather web site to a web application because of compilation times for the web site.
I also use pre-build events to move configuration specific configuration files around and pre-build and post-build events are not available in web sites.
In Visual Studio 2015, I've come to somewhat prefer web site projects over web app projects. I still use visual studio though because you get Nuget Packaging, you can install nuget packages to both types of projects.
However a WebSite Project does not have a project file, you are literally just adding a folder to your solution.
However you can still have code, but I prefer to put it in a separate project.
In WebApp projects you have your Assets, Css, Views (razor, aspx etc), Controllers/Code Behinds etc all in one project and it just mashes together. I prefer to work with websites in two halves. The front end (css, js, images, "html/cshtml/aspx/ashx/.master/etc") and the back end (all the code).
So I create a Web Site project and a class Library to accompany it (in visual studio you can add references to the web site project). I add my class Library as a dependency and all Code is in the class Library. You can still have a global.asax, you just have to tell it that the code behind is in another dll (not the one that the site will compile to). MVC views, you just specify the namespaces like normal (the dll is referrence so the namespaces are there). And in WebForms you Just have to remember to include the assembly name with your type references that the code is in.
It's a little tedious to get use to, but when you do you have isolated structure, everything is in a place that makes sense and modularized in an easy to maintain way.
And the PLUS side is that because the Web Site is just a folder (no project file) it can be opened in Visual Studio Code easily, and other popular text editors making it easy for designers to work on the css/js/images etc (which are not in the code project). Keeping the layer designers separated, the designer sees just what they need to see.
Now structure wise. I keep my code local on my machine checked into a subversion repository using Tortoise SVN and Visual SVN (java/.net shop). To test locally I install IIS and I set the website project up in IIS locally just like I would on the dev/prod servers.
Then I install MSDeploy on the dev/prod servers and I use the Publish web app feature via MSDeploy in visual studio and I use web.config transformations. So I have web.config transformations for dev and prod and the main web.config without transformations is for local testing (so it works for all devs on the project).
To previous stated cons: Having a WebSite Project vs a WebApp Project doesn't mean multiple developers can't work on it, that's only if your WebSite Project is on some server some where and you are loading it directly from there which would be bad practice.
You can treat a WebSite Project just like any other Visual Studio project, local code, source control, multiple developers.
As a final note, an added benefit of separating your code is you can put all of your code in a shared project. Then you can create a Class Library for each port you might do, say one on straight .net 4.6 and another on .net core 5 and link in your shared project. As long as your code is compatible with both, it will build and you don't have any duplicated code files.

Resources