What template to use for new website in Visual Studio 2015? - asp.net

I'm confused by the myriad of options for creating a new website in Visual Studio 2015.
In particular, I don't understand the difference between
File > New... Website... ASP.NET Website (Razor v3) and
File > New... Project... ASP.NET Web Application > ASP.NET 4.6.1 Templates > MVC 4
What I'd like is a website that works well with Entity Framework and provides scaffolding to quickly create data entry forms.
It seems MVC 4 provides this, but is there something similar for Razor?

The main difference between the Web Application and the Website is that it will compile the application into a single DLL file at build time. In order to update the project it must be recompiled and the DLL file published for changes to occur.
Read more at ASP.NET Web Site or ASP.NET Web Application? and Web Application Projects versus Web Site Projects in Visual Studio

Related

How to develop an aspx webpart for my SharePoint?

I´ve got a question!
I want to develop an aspx site for an sharepoint. I have Visual Studio and i cant find a way to develop an aspx page, only an asp.net core solution. Is this the same? Or what do i have to do, to get myself an aspx webpart i can upload to my sharepoint site?
Thanks for your help!
Aspx files are part of ASP.NET Web Application (.NET Framework) - Web Forms project type. So you must install .NetFramework if it doesn't show in project templates list.
Here is how to create a project.
Here is how to install .NetFramework in Visual Studio.

How to create an ASP.NET Web Forms Application in .NET v3.5

I am trying to add a new Web Forms project to an existing solution. However, when I choose .NET 3.5, the only option available to me is ASP.NET Empty Web Application, there is no choice of creating a WebForms app.
If I choose > v4.5 then it gives me the option.
How should a WebForms application be created under .NET 3.5?
Thanks
With 2015 you can create the ASP.NET Empty project, then use "Add Web Form" from the project menu.
Another option is to install VS 2013. I use VS 2013 through 2017 on the same computer, and the latest version that lets me create a .NET 3.5 WebForms project is 2013. The project template is under "Visual Studio 2012" group under ASP.NET projects.
Its possible that there is a project template pack for 2015/2017 that will give you WebForms and 3.5 but my quick search doesn't show anything.

Web.config transformation with SlowCheetah and ASP.NET Web site project

I'm trying to use SlowCheetah XML Transforms with an ASP.NET Web site project (not an ASP.NET Web Application Project) in Visual Studio 2010.
When I right click on the Web.config file in my ASP.NET Web site project, I don't see "Add Transform" item in the contextual menu.
(Note: it works well when a try with an ASP.NET Web Application Project).
Is it possible to use SlowCheetah with an ASP.NET Web site project ?
Or it's impossible "by design" because this kind of project has limitations ?
May be there is a workaround merging the "*.targets" files of the "Web Deployment Project 2010" and SlowCheetah...
SlowCheetah doesn't support website projects. What behavior were you envisioning here for website projects? For WAP projects they are kicked in during package/publish. For the Web deployment project suggestion I have created an issue to track that at https://github.com/sayedihashimi/slow-cheetah/issues/4, but I'm not sure how that would actually work. I'll have to think about that for a bit.
Update
Website project now has the same publishing support as Web application project, http://blogs.msdn.com/b/webdev/archive/2012/11/20/new-web-publish-updates.aspx, if you would like SlowCheetah to support transforming XML files please vote for it at: https://slowcheetah.uservoice.com/forums/185106-general/suggestions/3398137-support-for-website-project

How do you force Visual Studio 2008 to generate designer.cs e.g. Whatever.aspx.designer.cs

I have some webforms in an Asp.Net V2.0 generated using Visual Studio 2005 using Web site technology
Want to import them in to Visual Studio 2008 set to v3.5 (Asp.Net MVC) - where I use Project technology
I'm using Add > Existing Item - Which brings in Whatever.aspx & Whatever.aspx.cs
There is no Whatever.aspx.designer.cs to import
How do you force it to be generated ?
Right-click your aspx file and select Convert to Web Application.
You have to make sure that your project is a Web Application (and not a Website). Then, You can right-click on the file or the project and select "Convert to Web Application". If all goes well, the designer file will be created. If not, then there is a parsing error in the page.
But if you want your project to truly be a MVC application, then you should not be using code-behind files for your webpages (Views), so you need to refactor the codebehind classes into Controllers. See this article why not:
http://stevesmithblog.com/blog/codebehind-files-in-asp-net-mvc-are-evil/

How to get the Silverlight XAP copied to the clientbin on build

I am just getting started with Silverlight and have recently added a Silverlight project to an established solution. In this particular scenario my solution included an existing ASP.NET web site (not application) which Visual Studio kindly offered to integrated my Silverlight application into, which I accepted.
So everything is fine and all, and the Silverlight XAP is being copied to the web site's ClientBin directory. Now I have decided to start a new ASP.NET MVC web application that will eventually replace the older (non-MVC) web site. But I cannot for the life of me figure out what Visual Studio modified to get the XAP to automatically appear in the web site's ClientBin on build, so that I can reproduce that on my MVC site.
So my question is essentially, what are the manually steps for getting Visual Studio to autocopy a Silverlight application's XAP to a newly added ASP.NET MVC web application?
You can do this through the properties of your web project. The Silverlight tools for visual studio add a new tab to the properties of web projects named "Silverlight Links".
Add a reference to your Silverlight project here, with the folder where you want it, and visual studio will make the copy for you.
The copying of the XAP to the ClientBin is a MSBuild task. If you're using a standard ASP.NET project template it can be found under the Silverlight Link section.
For everything else you might be able to figure out the name of the MSBuild task and add it to your ASP.NET MVC project. The easier solution would probably be to use a custom post-build event on the APS.NET project to copy the file.
There is no "magic" happening, oter than copying the XAP file from the BIN directory of your Silverlight project to the ClientBin of your web application. It doesn't even have to live inside the ClientBin directory - you can copy it to any directory, or the root of your site.
Update: The recently released Beta 1 of ASP.NET MVC includes support for Silverlight projects, so you can link it to your ASP.NET MVC application the same way you do for regular ASP.NET applications.
Go to the property pages of your Silverlight application, Choose Build Events Tab, Enter following line in Post-Build events command line:
copy $(TargetDir)*.xap $(SolutionDir)<youar web solution folder name such as app.web>\ClientBin
Now onwards, on each successful build, the xap file will be copied automatically.
This is a somewhat older post so it probably has changed... in my Visual Studio under the web project there is a tab called "Silverlight Applications". There is an add button there for existing projects that you import into the solution and you can add them and choose to place the xap in the ClientBin or anywhere else. Not sure if you have to have the SDK installed to have this tab. I have it installed so you may have to. I don't do MVC, so it may be different for MVC projects, I don't know.

Resources