So here is a problem, during past few months I have been working on my Masters Project and haven't used source control. The project does big data calculation and requires a lot of RAM, therefore sometimes a laptop works really slow or stops responding and then I have to reboot it.
I wrote all the code in controller of my MVC Project. After my last force reboot, my controller has all nulls and does not show any previous code that I have written. In the same way, my app works fine and controller methods are revoked properly.
When I click on controller VS opens an empty notepad document instead of controller code. Unfortunately, I haven't used source control and don't have a build. Any help is highly appreciated.
Here are the files that I have in by debug folder:
In order not to face this kind of situation in future, please back up your data or use source control. If you were not careful like me and did the same mistake, then here is the solution:
Go to your project folder
Go to /YourProject/YourProject.Web/obj/Debug
Find YourProject.Web.dll
Go to https://jetbrains.com/decompilerand download .dll decompiler
Install decompiler and restore .dll to a project
Go to restored project folder->Controllers->RestoredController.cs
Once you open RestoredController.cs you will find the code you lost.
Related
I have created a custom control for my development team to utilize the CefSharp Chromium Web Browser. I have everything setup and working well. The only problem is having it run for projects that do not directly reference the chrome project in their solution.
I would like to find a way for when a developer drag and drops my custom control into their application, it will automatically copy ALL of the required files from the compiled control to their bin folder.
Currently, it only pulls the handle full directly referenced by the tool, but some are utilized at run time due to limitation of the utility for being able to compile for Any CPU efficiently.
Image of Files
I would like to have all of the files on the left hand side be copied automatically upon using the control from the tool box to the appropriate folder, or at the very least at run time.
Any information or ideas on where to look are greatly appreciated.
I managed to solve the problem, though this feels like back practice.
My issue what using CefSharp and getting all of the x64 and x84 files downloaded where ever require. I ended up adding a zip file of each content and then extracting them at run time as needed.
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.
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