I've been trying to publish my Visual Studio 2010 project. I do this by accessing a hard drive which corresponds to a URL, so X:\Options\Forms\HD\ corresponds to /HD. Yet when I go to the URL, it says I don't have a default.aspx page. Yet when I look in the corresponding file directory the default.aspx page is right there. Why is the browser ignoring it? Another issue I have is that not all of the files are getting published when I select the option in Visual Studio; many are left behind including my default.aspx.vb file.
To make sure files get published, make sure that they have the correct Build Action set (check the Properties window for the file). Especially, if it is set to None or if the files are not part of the solution/project they won't get published. The "Content" build action is a good choice for any file that just needs to be published.
Extra tip: for files that VS doesn't know the default build action is None. You can however configure VS to use whatever build action you want.
I've written about it here: http://blog.andreloker.de/post/2010/07/02/Visual-Studio-default-build-action-for-non-default-file-types.aspx
Also, I've created a simple tool that generates the necessary configuration file: http://tools.andreloker.de/dbag
Related
When I make a change to the a aspx.cs page in my website and then build I notice that none of the dlls in the Bin folder are updated, the only dlls I can see in there are the references the web app uses. I want to bring across this one change rather than redeploy the whole site so where are the changes being saved?
I've tried various things like build solution, rebuild solution, build website, rebuild web site.
Is it possible my dll is being sent elsewhere? How would I go about finding out where?
In Solution Explorer, on root project node, right-click and select Properties. Click on the "Build" tab and look under "Output" section. Here you will see the actual output path and can change it to your bin folder.
In Solution Explorer, on root project node, right-click and try to Clean solution and then again build whole solution.
I have a published website and I need to change only the ViewPage(.aspx) code that is giving me an error. If I change that viewpage will it be ok or will I have to publish the website again? If there is no need to publish the website, does it work for css, javascript/jquery files?
If you are only changing visual elements (or in line code that don't rely on a new Project.dll being created) then there is no need to publish the website as long as you are updating the files on the server. If you want VS to send the files to the server for you then you will need to re-publish it.
Publishing is an easy way to build your project, package it and send it to the server so you don't have to mess about with individual files. If you just want to change one file, be it .js , .css or alike then you can just change it.
Depends on what you're changing...
If you're changing elements that have a direct impact with the codebehind in the aspx.cs, then you'll get a runtime error. For instance, suppose you have an aspx textbox and you change the textbox to a radiobutton, or you change the textbox's id field then you'll have to compile the solution and publish the visual page along with the dll to the server.
If, on the other hand, you're just changing css, javascript, or html, and you're sure that does not have an impact on the codebehind, then you can just publish the visual page.
If you change the code of views, then you don't need to publish the site again. If you change code behind then you must publish the dll. When you change the code the dll of your project changes.
It is my first experience with asp.net. I have some large dll in my bin that never change and I would like to exclude them from publishing every time I make small changes to the pages. I know I need to add a section in my web.config but I do not know where and what to write in it to exclude the bin folder.
I already looked at few similar question on SO but none of them are really giving a clear answer to my need.
This is my web.config in which I have already added successfully the connection string for the production server and the error mode to have some feedback about errors during deployement phase.
Few lines of code to direct me on what to change will be appreciated.
To exclude any file from being copied; you can control this behavior by adding that file to your project; Once you add that file, you will see it in your Solution Explorer Right click on file and choose Properties . On the property page there is a Property called 'Copy to Output Directory' use that.
Whenever I update a small part of my website I have to upload whole website again.
If i upload only edited part it throw me exception.
The way I upload my website:
For example if I have 4 pages (home, register, about me, contact me) and if I update home.aspx, I publish whole website in a local address, and then I compress it with zip format and upload it manually.
Is it possible to publish only updated part?
It is not possible to publish only a part of website, but what you can do is to choose Single-File Assembly build option ,by this you can get single assembly for your page.so intead of updating whole application you can update only the pages you change
read more
What I always do when publish ASP.Net Webform project, I complate it with two steps. Maybe this way suitable for you.
When you use publishing tool on visual studio by selecting Build menu -> Publish, you can choose "File System" as "Publish Method", type your "Target Location", and select "Replace matching files with local copies". It mean the project will publish modified files only.
After publishing have done, Open defined "Target Location" using windows explore and sort by "Modified Date" and just copy newer modified files for each directory recursively to your server.
If you build the website pages into dll. You can not published only the aspx. there are many other dll and compiled files in bin folder, we don't know which matches which aspx.
If you only edited the "view", i mean, the html and markup part of <%%> code, and no code behind (.aspx.cs) change, you can published only this aspx. But remember to set website as updatable in the publish dialog.
I suggest you to compile the aspx into one dll. according to #Buzz 's answer. Then, your aspx files would be only an empty file. All you need to do is upload only one dll to the bin folder.
I have a couple of web pages in a folder, and want to copy the folder to have a set of similar pages (with only a couple of changes).
However, when I simply copy and paste it in Visual Web Developer I get errors:
Type 'WebApplication1.Folder1.WebForm1' already defines a member
called 'Page_Load' with the same parameter types
And:
The type 'WebApplication1.Folder1.WebForm1' already contains a
definition for 'form1'
So how do I make a copy, where the namespace or class name isn't exactly the same - Is there a way to let Visual Studio do it for me? If not - What should I change to have it work but not break the code?
EDIT:
Here's what I did:
New project
Asp.net web application
Added folder to project
Added webform to folder
Folder right-click copy
Project right-click paste
F5
Got errors
In the copied folder, you have to change a few things.
in the copied version WebForm1.aspx.cs code behind, change the namespace to something new. From namespace WebApplication1.Folder1 to namespace WebApplication1.NewFolder1
in the markup of WebForm1.aspx of the copied file, you need to change the "inherits" property of the page. It should change from Inherits="WebApplication1.Folder1.WebForm1" to Inherits="WebApplication1.NewFolder1.WebForm1".
you should change the namespace in any of file that was copied over as well, but if you just have an empty webform, then the first 2 steps should get you going.
There might be an automatic way to do all of this, (find and replace could work, or some other VS feature) , but i don't know about it.