How to setup Umbraco 6.1.2 in Visual Studio 2012 with MVC enabled to use in TFS? [closed] - asp.net-mvc-4

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
What I want is a development environment in Visual Studio 2012 for Umbraco version 6.1.2 (latest stable version at the moment) with MVC as rendering engine so I can use Razor and integrate a MVC project in Umbraco.
I also want to be able to use a Team Foundation Sever to share and store the code.
The problem lies here: When I just download the Umbraco files from Umbraco or use WebMatrix to install an Umbraco site, I do not have access to the core files or a way to properly debug my install in Visual Studio.
So I need a way to build and debug/run Umbraco from Visual Studio.
I looked at a lot of posts, articles etc. (also on StackOverflow) but none seemed to address the latest Umbraco version (most about 4.5.x) and only a few about MVC. Old references, non existing project templates or templates to old versions of VS made me have to dig further.
When I then found a solution, I thought about 2 things:
- 1 I need to check this solution
- 2 I should share this solution to a wider audience then it is getting now
Both two reasons are what made me post it here (clarification as asked)

Actually, all you need to do is create an empty MVC4 project and add the Umbraco NuGet package, as this will also add the Core binaries package and set the dependencies for you.

I found http://www.ben-morris.com/using-umbraco-6-to-create-an-asp-net-mvc-4-web-applicatio, which is the lastest article about the subject I could find (the download link in the article is to the old repository and not the current download page of Umbraco, though).
This setup worked really well for me (Umbraco version 6.1.2)
Firstly, start an empty MVC 4 project in Visual Studio – make sure
it is an empty project as you will not need any of the baggage that
comes with other project templates.
Add the NuGet Umbraco Cms Core Binaries package which will manage the various dependencies and
references that Umbraco 6 requires for you.
Copy all the files from
the Umbraco installation ZIP archive directly into your project in
Visual Studio except the App_Code and Bin folders – you won’t need
the binaries as they are managed by NuGet and the App_Code folder is not used in a web application project.
If you want Umbraco to play nice to MVC and be able to use Razor views, you should change the default rendering engine to MVC in Config\UmbracoSettings.config like so:
<templates>
<useAspNetMasterPages>true</useAspNetMasterPages>
<defaultRenderingEngine>Mvc</defaultRenderingEngine>
</templates>

One problem you will have is ensuring all necessary files are checked in when modifying your umbraco site locally.
For example if you add a media image using the umbraco backend. Visual studio won't automatically add it to the project and therefore source control for you so a check in will miss it. You have to include the files in the project manually which can become tricky when big changes are made.
I'd like to know if anyone else has a better way of managing it.

Related

VS 2019 Custom ASP.NET Core project templates

I'm trying to figure out how (or even if) I can create a custom Visual Studio project template that hooks into the existing ASP.NET Core Web Application template available in Visual Studio 2019?
What I want to do is something similar to madskristensens ASP.NET Core Template Pack (GitHub source code). However instead of VS 2017 I want to do this for VS 2019's revamped "New Project Dialog" window. So imagine adding an additional ASP.NET Core web application template in the place highlighted below.
I am able to create new project templates (both for Visual Studio and for dotnet new) but nothing has worked thus far. Has anyone been able to extend VS 2019 in this way, or was this taken away after VS 2017?
After doing some more investigation between both VS 2017 and 2019 (Community) I was able to successfully figure this out! Man oh man do we need some docs on this because this felt like a doozy!
I was able to use the ASP.NET Core Template pack as a building block for putting something together. For those who don't know, the extensions are designed to add templates to Visual Studio using .nupkg file(s) embedded in the extension. The use of the .nupkg files is similar to how dotnet new works with custom templates. I've got a working prototype on GitHub that supports both Visual Studio 2017 and 2019.
Now if you're like me, you may look at either madskristensens or my project and ask "How in the heck does this work!?" Great question! Here are the details I have the time to fill out right now:
Build out a custom template (or templates) and place them into *.nupkg file(s)
In my sample, my SampleTemplates project contains three different project templates. I generate the .nupkg with dotnet pack
A vs-2017.3.host.json file is required in the .template.config/ folder so that the ASP.NET Web Application wizard can display the template.
At least 1 or more other requirements need to be fulfilled to be displayed in the ASP.NET Web Application wizard, but I haven't yet figured those out, as adding the file to a console app template doesn't cause it to appear. I want to try and figure this out, although I'd love help if anyone already knows!
The template.json needs a Framework symbol to define the list of .NET Core framework targets that are supported by the template.
In doing some testing, it didn't look like the Framework symbol didn't substitute into the .csproj, so that is why my example also includes a TargetFrameworkOverride symbol that the Framework symbol replaces.
Place the .nupkg file(s) into the root of a VSIX extension project and make sure to set the "Include in VSIX" flag to True. I emphasize root because originally I had the NuGet package landing in a build\ folder in my extension and my templates weren't being picked up.
I'll try to put together a README in my example project to provide a better outline of all of the details required to accomplish this. Fingers crossed this helps someone out (or at least help me out in the future when I inevitably forget how I accomplished this)!
Update
As of September 2nd, 2020, the Visual Studio team released an experimental feature to include dotnet new templates within Visual Studio. I have done some exceptionally minimal testing with it, and it does appear to work, but it's not perfect. For example, I created a dotnet new template that scaffolds multiple .csproj files and .sln file, and the output didn't quite match my solution.
This is the Visual Studio blog post describing the announcement: https://devblogs.microsoft.com/dotnet/net-cli-templates-in-visual-studio/

How can I create and run both an angular and react app in asp.net core 2.1 app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
This page talks about creating an angular app in the ClientApp folder. I want to create a react app which can be accessed through another asp.net MVC route.
What changes I have to make in the asp.net core application created by the Visual Studio 2017 to have both the SPAs running.
Visual Studio has most of the templates available at the release time of 2.1. I'm not sure if VS 2017 didn't include it for a reason, or if they are catching up to the ASP.NET Core team, but you can scaffold a new react app by simply opening a command line and typing
dotnet new react
The dotnet new templates are the same exact templates that VS 2017 creates for you, except for some reason the React one is missing from the UI at the moment.
Personally, I would not not tie my Angular or React project to the UI except in the case of a relatively simple app. However, if you have two separate UI components for the same API, I would consider that a complex scenario and start to separate my concerns.
I would build 3 separate projects.
Api/
AngularApp/
ReactApp/
There are many reasons to do this.
Angular has different dependencies than React, if try to force them in the same project you will probably get some dependency version conflicts.
Separation of concerns. Never a bad thing.
Angular has it's own CLI to scaffold the app, modules and components. I would use it to it's full capability, because that's what it was designed for.
Easier to develop. Each has a development server with file watchers to rebuild your project after you make changes to your file and hit save. .NET Core has dotnet watch, Angular has ng serve, node webpack and some others for react.
Deployment would be a breeze if you Dockerized your project. One docker-compose file could launch all 3 of the development servers.

MVC4 - AuthConfig.cs missing

I am trying to get started with the OpenAuth features of MVC4 as described here:
http://pluralsight.com/training/Player?author=scott-allen&name=mvc4-building-m7-security&mode=live&clip=9&course=mvc4-building
I already did start over again a couple of times in order not to miss anything, but even though I am choosing the right template (Internet Application) there is no AuthConfig.cs.
Nor do I find documentation what to do to get the required tasks done manually.
I am pretty sure this is a pretty dumb question, but maybe I don't find the answer because it is so obvious...
thx
I followed these steps:
Open File/New/Project
Select ASP.NET MVC 4 web Application
Then Select internet Application
Once the project was created there should be a AuthConfig.cs file within App_Start folder
unbelievable.. I used the RC Version of Visual Studio and even though I reinstalled MVC4 from scratch the recent version including the openauth extensions wasn't properly available.
Following the same steps on the regular Visual Studio Installation did the trick...

Umbraco 4.X on Mono / MonoDevelop

I'd like to grab the latest version of 4.X umbraco and get it working on Mono, and be able to edit (and build) the project in MonoDevelop.
There's a great video of someone running it here but no instructions. All I can find is an old and mostly out-dated detailed article as referenced by this SO post: MonoDevelop and Umbraco
I've tried downloading the latest Umbraco source, which since it's a web site project won't open on MonoDevelop, so I created a new web application and copied eveything from umbraco into that project. I then included all the umbraco files in the web app project and then added references to all the DLLs that were in Umbraco's bin folder. This compiled, but errors all over the place when I try to run anything - e.g.
System.InvalidOperationException
Current has already been initialized. It is not possible to re-initialize Current once it has been initialized.
Before I give up and go back to Visual Studio, can anyone advise?
It doesn't run on Mono out of the box, but a community member named Can Koluman has actually created a version that does work on Mono and is developing it further. Hopefully one day it has Mono support out of the box. Read more about it here:
http://our.umbraco.org/forum/core/general/32923-Umbraco-472-on-Linux?p=4#comment131290

Web site to dll

I need to compile my web site, is it possible without converting to a web project first?
I think he wants to "protect" his code for any deployment.
If this is a .Net project you can try hide some code using codebehind components in ASP.NET.
Here is an small tutorial about it:
http://asp.net-tutorials.com/basics/code-behind/
For older projects you may have to build a cgi binary application, but as already mentioned here, add some more details to specify your problem.
I think you want a VS Web Deployment project. This exists as a separate project in your solution but can compile and copy the existing web project to a different directory.
There's a reasonable write-up of it on this blog with step-by-step instructions. You'll need to download and install the new project type separately though (2008, 2010)