I asked question yesterday, which wasn't answered. I gathered some more details and now I am able to ask it more specifically.
Generally, I have two PCs: PC1 and PC2. On both I have VS2017 Community installed. On PC1 everything works just fine.
It's PC2 I have concerns with. First of all, I miss all Razor templates. I can't create ASP.NET project with Razor Views, if I create empty web project, I can't add Razor View (cshtml file). To be clear - I can do everything on PC1.
Secondly, on PC1 I have below option, on PC2 I don't:
I have Web development kit installed in both VS's. I don't know what is wrong.
Edit
Here's what I get when I navigate to Web->Web site in New project window:
Your PC2 is probably on a newer version of VS c17 with the update explained in this blog post:
Visual Studio 2017 Version 15.5 Preview
Creating ASP.NET Web Applications: We’ve rearranged the ASP.NET project creation menu items a little bit to improve discoverability and increase the likelihood that you’ll choose the right project type for what you’re trying to do. Now, the commands to create a Web Applications or a Web Site are visually next to each other in the File->New Project dialog. This should help the majority of people discover the Create a New Web Application path correctly the first time.
Should just have to go File>New>Projects... then there will be a Web Site option under Web
Related
I'm running Microsoft Visual Studio Professional 2019 (Version 16.11.5) and am trying to get my application .dll and .pdb files to rebuild. This is an ASP.NET Web Application using the .NET Framework. Most solutions out there state that using "Clean Solution" will do it, but that choice is not available on the Build menu?
Well, you only get that menu for a compiled project, or what we call a
asp.net web application
but, if you are using a
asp.net web site
Then you don't have a clean, and in fact the web site gets compiled on the fly by IIS and the web site - not Visual Studio.
So, if you using a asp.net web site application (and you should!!!), then you will see and get these options:
NOTE VERY VERY CAREFULL!!! - NO build web site!!!!!!!
However, if you open a web site, then you don't see those options. You see this:
Note in above - build web site. And note no clean application.
The "clean" option applies to both desktop, or web applications.
The difference?
Now, in most cases I MUCH prefer a web site application (but this makes single page code updates to the site MORE difficult, yet I still perfer that choice!!).
The list of differences between the two choices here are VERY long. But when you deploy, or run the application, then all pages (code behind) are taken and compiled down into a single application .dll (much like a desktop program). You also have MORE options such as being able to build and make a custom logon system (a custom authentication provider). And you have used a .sln (project file) to open this "applicaiton"
However, a LOT of people like using a asp.net web site. There are several reasons:
You can modify JUST one page + save and not have to re-compile the whole site.
You can publish to a sub site, or "low cost" hosting
Your main page, application startup is NOT really a whole site,
but in effect just web pages being pushed up to a existing web site.
And even development is "easer" with a web site - you can modify one page (including code behind, hit ctrl-s to save, and you are done.
With a asp.net web application? You have to re-publish the WHOLE site again, even for a small one change to some code behind on a page.
So, as noted, did you open a "sln" file? = asp.net web site application
Or, did you just go open->open web site? = aspnet web site.
There is not going to be a "clean" option for asp.net web sites, since as noted, the IIS and web server will do the code compile for you, as opposed to a web site application, in which a set of .dll's are compiled into the bin file. (and in fact the main code behind gets compiled INTO ONE .dll with a "application"). As noted, with a application then publishing is more difficult, and you can't just update one page on the web site (code behind). With a asp.net web site, you can update the one page - and often some need or find this ability an advantage (I personally don't).
So to be really clear - a asp.net web site is NOT compiled by Visual Studio when run. With a asp.net web site application, the compile of the application occures first and THEN is passed to the IIS web server and then run - in that case, no on the fly compile of code occures, except for code app_code. So, as a result, I even use a foler called MyCode, since I don't want the web site to compile that code for me. (in fact, I had code break, since I started using vs2019 - and the newer "rosylyn editor - and it allow for example free strings such as sql statements in the code editor, but IIS can't compile them unless the web server .net compiler was upgraded to a later version).
The question may be a bit idiotic, but I can't find the answer on internet or Microsoft tutorials.
The goal of my project is to build an API to has to run locally on a Windows computer. My API mustn't have an interface or things like that, so I deleted every views and other files like bootstrap or jQuery. Then I call it with Unity.
The API works well, but I always run it with Visual Studio 2019. Is there something like a .exe or a command line to start my API ?
Thank you for your answers ! :)
PS : Yeah I know that an API running locally is quite useless, but with Unity it's really complicated to use things like pipes...
You can host your WebApi application in IIS, so you don't need to run it with Visual Studio.
If you are developing another project, you can ask Visual Studio to run multiple projects during a debugging session. While debuging your unity application, Visual Studio will run your API in the background:
https://learn.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2019
Otherwise, you may self host your asp.net webapi application.
There are official Microsoft tutorials on that:
For WebAPI 1:
https://learn.microsoft.com/en-us/aspnet/web-api/overview/older-versions/self-host-a-web-api
For WebAPI 2: https://learn.microsoft.com/en-us/aspnet/web-api/overview/hosting-aspnet-web-api/use-owin-to-self-host-web-api
I have a Visual studio solution with 3 projects (umbraco cloud site). One of the projects is a website that runs on a webserver (web), it references another project which contains the business logic (core).
Id like to use miniprofiler to profile the referenced DLL when im running the site but i dont seem to be able to see the results on the front end of the site. I can see steps that ive added in the web project however.
Is it possible to do this? Thanks, Jonny
I am sorry to ask a question which doesn't have a specific problem, but I would be more than grateful if you could point the problem. (I can always provide other parts of my code which would be relevant to my question)
I am using Visual Studio to create my web application with ASP.NET MVC Core. All is good with the project and I can make it work on my localhost.
I bought a third party hosting service with Windows hosting (Plesk) and as far as I've asked them, they said their hosting plan supports ASP.NET Core.
For the deployment part, I've literally searched each and every source and tried various different methods but could not properly upload my files on ftp. Trying ASP.NET Core 1.0.0 version worked well and I uploaded a sample website, but since I am working with ASP.NET Core 1.1.0 now, I am unable to find a solution.
Here is what my publish profile looks like before hitting publish button:
I'm not really sure if I filled all the information correctly, but validation seems to work well.
And here is the log which I get after trying the publish via ftp method in visual studio:
Even though it seems to succeed, when I look at my ftp directory after this process, the files in visual studio project were never uploaded in the directory.
Any help is appreciated, thanks.
I have deploy the same on my server and it is working fine see the attached screenshot.
I am adding an ecommerce section to an existing web application using NopCommerce (open source ecommerce package). Since the ecommerce section is logically different and Nop is built on MVC and my application is web forms I am keeping everything separate in my solution. When debugging locally I have all of the projects setup to use iis so I am able to debug them as a whole. All this seems to be setup good but when I go to publish the site I have to publish the three web apps (my app, nop, nop admin) separately. Is there something in vs2010 that I can use to publish all three applications at once? I guess it isn;t really that big of a deal but I would like to set things up correctly so any ideas, comments, or references would be great. Thanks!
I think it is not possible with Visual Studio environment but you can run the command line tool - aspnet_compiler from within the batch file.
Found an interesting blog-posts:
Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong
How To Create an ASP.NET Application from Multiple Projects for Team Development
VS 2005 Web Deployment Projects
ASP.NET Deployment Content Map
How to publish an entire solution as a single Setup file