i have a Visual studio project. it has .aspx, .aspx.cs, config, dlls and so on...
Regularly what i follow for loading a gui on the server is:
build the solution
publish the solution (so i get the published files of the project excluding .cs files) this makes sense as i dont want to give my backend code.
finally i run the gui on the browser.
This works perfectly fine.
But now i have to make a change in .cs file of one of the pages.
do i have to build the solution and publish all the files?? how can i just give the file i made the changes in.
I ask this because it does not look good to a client...
any suggestions?? thanks
If you make a code change you should republish the site. Bear in mind that you can just publish the newly compiled assembly itself and not all of the aspx files.
However, I don't recommend doing this as the time to deploy an entire site isn't particularly large and you might have made a change to an aspx and forgotten between deployments. It's much better to send the whole thing.
Also, this isn't a normal thing for a client to have a problem with. Tell the client this helps ensure robustness of the deployment. After all, if you made a code change in a language like PHP and deployed that single file then you don't get compile time checking and stupid problems like misnamed variables might not show up for awhile or might crater the whole site.
IMHO, it's much better to get the full compile time checks out of the way BEFORE the site is pushed. Of course, this does little to nothing for runtime problems.. but that's a problem you have no matter the language.
C# doesn't have .obj and linker like c++, so if you change one file and want to integrate it in your project, you should compile it in related project (just changed files going to be compiled), also for file compile option see this: http://msdn.microsoft.com/en-us/library/78f4aasd%28VS.80%29.aspx
Related
So in VS, I create a project, right? Let's say I'm following a tutorial that has extra code that I don't need that only serves to show examples for looping, threads, etc. - then moves onto the real code. I take notes of everything so I usually save a copy of my source code with a different name as future notes. Now the only thing with projects in VS or any other C# compiler is that if you save the file AS "..." or make a new file, sometimes I find that the compiler will now compile the new code or the old code (it gets me so mixed up).
I get why it does this though, to link to other sourcefiles right? Well anyway, all I want to know is how do I compile a different C# file within my project folder? I don't want to create a new project, it just makes it harder for me to organize.
Assuming you want to include a lot of files into project bu only compile one you can just change "Build action" to "none" from "compile" for CS files you don't want to build.
I am building a personal website using asp.NET's webforms in visual studio 2013 express for web and am following this tutorial:
http://www.asp.net/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/introduction-and-overview
My page is structured exactly the same as in the website, I have changed some minor stuff to make it my own but the structure in terms of the C# classes and how the interact with the HTML are exactly the same.
I got to section 5 of the tutorial "Display Data Items and Details" and everything was working fine. I've used git a lot in the past so I decided to create a repository for this project so I can access it at work if I feel like.
Suddenly now when I make changes to the C# classes it won't build. It's even stranger because I if I make a change on an HTML file the change is built. In section 3 of the tutorial we learnt how to make the 'product' classes which are displayed on the products page. If I want to change one of the product names for example, when I build the change is not there. Simultaneously I went and changed some info in the HTML for the contact page, IT CHANGES when I build. Why wont the C# changes take effect when I build any more?
I am relatively new to both asp.NET and visual studio. The HTML changes when I build and the C# does not. When I change either I can see in solution explorer that there is a red tick for pending changes. Why would only the HTML pending change be included in the build and not the C#? How do I ensure that the build is actually building the version I see in my editor window?
EDIT
I do not know if I found the original cause but I found a solution/workaround. I realized that the classes mentioned above were grabbed by the html page from the page's database. The .mdf file for the solution was not being rebuilt whenever I cleaned and built so I physically deleted it and rebuilt the solution and voilla my C# changes occurred. I am still fairly new to this whole thing, can someone explain what the .mdf file does and why it wasn't being rebuilt?
Check your .cs files properties on the properties window in visual studio to make sure their Build Action is set to "Compile", Things that are not set to "Compile" do not get compiled. How MSBuild treats project items depends entirely on their build action. CS files default to "Compile" when you make them, but if you changed them yourself that would be why it doesn't update. Also CS files placed in the App_Start folder default to "Content" and they are compiled by ASP.Net when the Application Starts, so if you changed something in App_Start you need to reset the site.
Not exactly sure what is the problem, but I would do a right mouse click on the solution in Solution Explorer->Clean Solution, then do another build and see if that helps.
I am a Front-end developer, currently working on a .net project. It was explained to me that some of the resources of the project are embedded and when I say some, I mean most of them. Therefor when making changes in the files, you can't see them in the browser without first re-running the project from Visual studio.
I believe you see how this is extremely annoying and frustrating to me. I am used to more dynamic way of working, even have something like livereload running to inject my styles and refresh the page when markup has changes, so I can see the changes in the browser without even switching the active window
I was wondering if there is anything even remotely close to what I am used to as a workflow for web development
Files including aspx and cshtml can be saved (most of the time) and will show changes upon page refresh. Occasionally, the file system may access the files and overwrite them. Files that are compiled upon build are not able to be changed unless a rebuild is issued.
In short terms, front-end is easily edited during run while code-behind and classes cannot.
You've tagged this as MVC, so that means if the view is changed it can be reloaded without running it from Visual Studio. Further, the project just needs rebuilt if you change code. You don't have to re-run it from Visual Studio.
So, in short, you can certainly still make changes in the browser with livereoload, then move those CSS changes to the CSS files in the application, and refresh your browser. That's it.
EDIT: After seeing the screenshot, change that to Content instead of Embedded.
So, I've had to rework a web app on one of our servers, a legacy app, that needed to get new branding via a common master page, where it previously had none. The page displays ok, but there's a form on it that calls a method in a compiled dll which allows the user to download a document. This throws an error, but the error is vague (mentioning a null reference). We have the source code but I don't have visual studio installed on my machine and even if I did we suspect it may have something to do with the server environment, and the server is not set up to run project files, just compiled web apps. One of my colleagues thought that by removing the dll, the app would just use the cs files and compile that at run time. That didn't work, and another colleague suggested turning debugging on in web.config, which we did, but still no go. He also mentioned that debugging required pdb files, but I don't see any in the source code we have. If I could get this working on the server just using the cs files vs. the dll, I could at least attempt to debug what's going on, any ideas on how to get that working?
There seems to be a good deal of confusion here about how ASP.NET applications work.
First, .CS files are meaningless to IIS. IIS knows about files containing markup. It also knows that the assemblies contained in the bin folder represent the server-side code that handles the incoming requests and generates the outbound responses.
In most cases, when a site is deployed to a production server, the .CS files are not included, because they are just noise on the server, useless file clutter that have no bearing whatsoever on the execution of the application.
Now, you're kind of lucky, because you have the source files there. You can, actually, force a recompilation of the cached assemblies. To do this, open the site's web.config file and add some whitespace (a single space) to the end of the first line. Then save the file. This will cause ASP.NET to clear its cache and rebuild the site.
This isn't guaranteed to get rid of your problem. Like you say, the problem could be somewhere else. What I would strongly suggest is that you download the site in its entirety, install Visual Studio (get a free express edition if you have to), and DEBUG the darned thing.
If you can't run it in a debugger and watch it execute, you're just guessing.
PS If this thing isn't under source code control, get it there, ASAP.
What to do now, this time??
I hate VS and this symbolic gibberish that never seem to have same solution (if it once was logic) twice. The screendump below says what it says.
As soon as I F5/Start the web project, the breakpoint going yellow. This ONLY affect the aspx.cs file that being changed. The other aspx.cs files can have breakpoints.
When I do rebuild/build all DLL and PDB files are created just fine. They have same compile time and are in same directory. Module-Windows i VS says the symbols are loaded perfectly. Well, yeah, try bite me!
I can tell, all symbolic is working just fine, until I was about doing changes inside those aspx.cs files (which was some time ago since last time). If I reset back the file, the breakpoint are working. If I try to make changes in another file, the problem appears there.
It simply appears like that the symbolic file generator don't understand changes maded in aspx.cs files..
Have you got compilation debug="true" set in web.config?
http://msdn.microsoft.com/en-us/library/e8z01xdh(VS.80).aspx
This sometimes happens if you have changed the starting url in the Web -> Start Action -> Start URL to a different location. It could also be something in the Web -> Servers pane where something is set other as expected.
Also make sure the website in IIS (if you have configured IIS) is located to the right directory (where your project builds the output), otherwise it can't start debugging either.
I've found a good hint (see my comment higher in this thread).
The WEBAPP have, as seen above, an _dll path.
This _dll path are there because this project has dll files shared with other projects. This means save space and don't have copies of same files for several projects.
Though,
This raise problems beause the webapp still are output/copy files to it's own sub bin/ directory. And even worse, not ALL needed dlls, which make error when the running web project (due to missing xxWeb.dll, which copies to _dll bin).
Accepting the fact to use standard bin/ fixed the problem this time. Why? The answer on that will not be in this thread, sorry. Someone with an idea would course make a comment here. In general, this isn't a drawback because the webb project binaries should be at the end of reference tree..
Open Visual Studio Command Prompt
and Run devenv /resetsettings