I'm going to host my ASP.NET MVC website in GoDaddy. It says that I have to publish it first before I can host it. I'm following this link (http://www.c-sharpcorner.com/article/how-to-host-your-Asp-Net-mvc-website-on-godaddy-server/) for hosting my website. But when I check the content of my File Manager in my GoDaddy account, some folders of my project is not there (like the App_Data, App_Start, Models) Why is that? Thank you in advance.
I checked the guide you used to publish your website. On step 16 it said to check "Exclude files from App_Data folder". If you check this App_Data folder does not get published. If you want to publish files in app-data folder then uncheck it while publishing.
Secondly, when a website is published, a .dll file is created for each project, so all your classes in app_start and models folder are already included in that .dll. You can find the .dll file in bin folder by the name of your project.
Related
I want to upload my asp.net mvc project to a server. I connected to the server via ftp and i don't know which files to upload prom the project. I have three folders, the names are .vs, Agenda(my project's name) and packages
and one file Agenda.sln.
In Visual Studio - Build, Publish has an FTP option that you can enter your FTP credentials and it will upload what needs to be uploaded.
If you want to do it a little more manually, publish to a folder on your hard drive and then copy those files manually (via FTP) to your web server. That will also show you which files need to be uploaded.
Mostly - you want the project file, but I would use the Publish option and look at the files it copies.
I am using TFS 2015 for creating builds of application. I am able to create build template for web application as web application have both .sln and .proj.
But for Websites, I only have .sln file and no .proj.
How can I create Build definition in TFS 2015 for website having only .sln file?
As #Cece said, the answer is yes, you can run the MSBuild on the server without a .csproj.
I am assuming that your project is not running on the final version of the .Net Framework. In your case I suggest you to make this change
https://stackoverflow.com/a/42493822/819153
Then you should copy all the files from the PrecompiledWeb folder, and there you should find your .sln
Sometimes there are vb/cs projects that I have seen that they do not come with a project file, csproj or vbproject. They run with the .NET Framework 2.0. For those, you can create a build definition just to compile the .sln, but when you deploy the application, you need to copy the entire PrecompiledWeb folder to the IIS folder on your server. Try to add the task that has the option copy and publish and put all the changes to your server.
Check the privilege of the folder where you want to put the files, and be sure that the agent that is running the builds on the TFS has access READ/WRITE access to the server folder.
In your case, please check the .sln file, inside of it you should have a TargetPath, by default is PrecompiledWeb, but sometimes when you run the msbuild on the tfs you end with an error saying that the PrecompiledWeb can't be on the same tree of your solution, what you need to do then is putting a level up of your solution folder
Debug.AspNetCompiler.TargetPath = "..\..\PrecompiledWeb\YourProject"
Then on your CopyTask you need to change the CopyRoot directory, if you made any transformation before your build step to the webconfig, those transformations will be reflected on the PrecomiledWeb\YourProject. All the files in that folder should be deployed to the server folder path.
Lets say that you have this structure in your Branch
Branch/MyProject, then after you compile the source code on the TFS, your precompiled folder will be stored at the same level of your project on the agents folder. Please see the picture below to get the idea how to copy the files from the PrecompiledWeb.
The answer is Yes. You can create a build definition for a WebSite project by specifying the .sln file.
I have created a ASP.NET MVC site and now I need to upload it to web hosting server, for that do I have to upload whole project or only selected set of files & folders. If so what are the folders and files should I upload to the web server?
Just right-click the project in Visual Studio and select Publish... This will publish the required files to a folder from where you can upload them.
A couple of points to note.
Set the build config to Release before running Publish. This
substitutes in the values in your Web.Release.config file which sets
debug to false by default but you can also put in server connection
strings and other production settings.
Some dll's which are required will not be included in the Publish
folder by default. To include a Referenced dll select it in the
Reference folder and set its Copy Local property to True. It is a bit
hit and miss figuring out which dlls are not on your server and need
to be manually added..
I try to build a website app. using TFS 2010 automatic builds with a custom build definition template. The build fails when tries to copy the dll references to the Bin folder:
\Lib\AjaxControlToolkit.Binary.NET4\AjaxControlToolkit.dll" to "..\Portal\Portal.Web\Bin\AjaxControlToolkit.dll". Access to the path '..\Portal\Portal.Web\Bin\AjaxControlToolkit.dll' is denied.
The application is a website and not a web application. In the LIB folder I keep all 3rd party dlls used by the website(such as the ajaxcontroltoolkit) Also both Lib and Bin folders are added to the source control.
The problem that the folder structure you made to and stored in the TFS not correct, because the bin folder should not be stored on the TFS, and the third party libraries should stored in a shared binaries folder, so you will need to adjust your folder structure in the TFS and in your local.
For more information see this link:
P&P TFS Guide
I know I can just copy all of my files from my development environment into my live website directory, but then I know I'm copying several files that aren't necessary (e.g. the .sln file and .csproj files).
What files actually have to be copied for ASP.NET MVC web applications to run? (E.g. Do I need to copy all .CS files?)
If you develop in Microsoft Visual Studio, you can use the Build > Publish option (when you're in the context of an ASP.NET MVC project) and publish it directly.
If you cannot use this and have to do a copy all you need is anything that ISN'T a .cs file (views, .config files etc) and your compiled ASP.NET MVC site's .dll (ex MvcApplication1.dll). If you want to get an idea of what you need use the Build > Publish tool to a local directory and take a look at what's in there.
You don't need solution or project files.
Using the Build / Publish approach is the best to ensure you have the files you need. Before building though, if you don't have ASP.NET 3.5 SP1 installed on your server, make sure you go into the references in your project for the following assemblies and set the to "Copy Local" in each of their respective property pages.
System.Web.MVC
System.Web.Routing
System.Web.Abstractions
This will make sure that each of these assemblies is copied to your "bin" folder on the published site.
Brian
After you compile your project, you shouldn't copy all .cs files.
Take a look at this link.
Basically everything but the views get compiled into a dll. You can use the deploy option to see what you need to deploy ;).