I have an ASP.NET 4.0 MVC 3.0 website which I have built and published into a directory on my machine ready to FTP to my hosting site. I have two .doc files which exist in a folder under the Content folder. When they were in their own folder, the folder was not included when published. I then included them in the Images folder under Content. When I publish, all the files in the Images folder are included except the two .doc files.
Why are the .doc files being ignored?
I took a closer look at this and I'm pretty sure it has to do with the build action of the files. If you add files such as Word docs and Excel docs to a project, Visual Studio does not include them with the publish by default. However, it will include image files and other similar content by default. To get the files to be included with the publish, right click on the document in Visual Studio and select Properties. Set the Build Action to "Content", and you should be good to go.
Related
I want to publish my Web application to a ZIP file. To date I have been doing this by publishing to the file system, then manually zipping the output.
Is there a way of creating the ZIP file directly from Visual Studio? I've tried publishing using the publish method "Web Deploy Package". This generates a ZIP file, but the ZIP file contains a folder hierarchy that looks something like:
Content\C_C\...\MySolutionFolder\MyWebApp\obj\Release\Package\PackageTmp\
that mimics the folder hierarchy on my development machine. I just want the actual web content, i.e. the content of the PackageTmp folder.
I don't understand why the ZIP file contains this folder hierarchy: it means that deployments created on two different development machines with different working folders for the same source-controlled Visual Studio solution will produce different packages.
I am using Team Foundation Server 2013 and have the nightly build configured to deploy a web application. The web application is making use of the web API help pages which depend on the built in XML documentation files.
I currently have these XML files being output to the App_Data folder. These are not being copied to the server during deployment. I tried checking in the documentation files but when the build process tried to regenerate them it caused an access error as the files are read-only.
I currently have a placeholder text file inside the App_Data folder included in the project to ensure that the folder gets created but I have to manually copy across the documentation files in order for the help pages to work as intended.
What is the correct/best way of forcing these files to be copied?
Thanks
Ensure the project build order has the docs being built first. Right click on the solution and choose Project Build Order
Then add some MSBuild logic in your pubxml or wpp.targets file to add the generated help files to the FilesForPackagingFromProject ItemGroup.
http://sedodream.com/2012/10/09/VSWebPublishHowToIncludeFilesOutsideOfTheProjectToBePublished.aspx
Open the solution, right click on the .xml file, click Properties, for 'Copy to Output Directory' select 'Copy Always'.
I got some files necessary for the hosting environment, e.g: robots.txt as in the attached image.
But I don't want to store them in Visual Studio solution, because they are not a part of my project, it will be confusing to have these under the solution folder or source control.
So, I am thinking is there anyway to let Visual Studio automatically copy these files from my custom location (e.g: D:\HostingPrepareForST\ ) to the output folder when I hit "Publish" to publish the website?
we are developing a web application using MVC3 and VS2010. We have some pdf files under Content\PDFFiles folder. when we publish the website to our server using "File System" publish method, it does not copy the "PDFFiles" folder to the server. however it is copying the other folders (images, themes) from "content" folder. "PDFFiles" folder is additionally added to have pdffiles used by our web application.
anyone know the reason behind it?
Thanks,
In the Visual Studio Solution Explorer when you right-click on each of the items (files) and select Properties what is the Build Action? Is it Content? If not give that a try.
You can also include an extra folder with all its contents editing the publish profile: http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-extra-files
I'm stuck on this tutorial for creating a multi-project visual studio template. I'm specifically stuck on this line:
Select the files and folders to include in your template, right-click the selection, click Send To, and then click Compressed (zipped) Folder. The files and folders are compressed into a .zip file.
I did the following steps:
Create 2 projects. (MyProj.Web and MyProj.Service)
Reference MyProj.Service in MyProj.Web.
Export both. They are now in a .zip file.
What do I do from here?
My intentions are: Make solution folders where some dlls will be (DI, unit testing frameworks, etc). Have these dlls referenced. Reference projects in other projects. Rename part of the projects. For eg. the ability to replace {MyProj}.Service with NewName.Service
The other parts includes making the .vstemplate xml file and placing the zip in the ProjectTemplates.
Per the article:
Put the .zip template file in the Visual Studio project template
directory. By default, this directory is \My Documents\Visual Studio
2010\Templates\ProjectTemplates\
The Visual Studio template will then be available from File > New Project. If making a template for a single item, place it in the \ItemTemplates folder instead to make it available from the Add New Item context menu in Solution Explorer.