So I was brought into this project (C#, asp.net) which is already functional, but I need to edit it. All the source files are compiled, so in order to edit this I need all the aspx.cs files, but whenever I decompile the dll that is supposed to hold them all, I only get some of them. Half of the aspx.cs files are missing. I know for a fact that they should exist, as the site is functional. I have access to the other aspx files as well.
How would I go about finding these remaining missing cs files? Any clues as to where they might be located?
Related
This question might seem dumb, but I cannot quite understand the concept of C# compilation
I'm working on a C# project that contains two merged solutions
The first solution saves settings in the form of .resx resources files and the second solution reads them in said resx file located in roaming directory using Resource Writer and resource reader.
Now my problem is that I want the first solution to be able to compile the second solution's exe file while merging or embedding the resx file that contains the saved settings.
I'm not sure what should I do or what should I use or how to do this, this is my first time working on something that manually compiles the solution, I would've searched it on the internet but there are not a lot of tutorials concerning this specific matter, I felt lost and thus I'm seeking help from this forum in the hopes of finding a fix for this frustrating matter.
I've recently taken over working on a .NET site. The original developer is uncontactable so that I don't have the source files, all I have are the aspx files and their corresponding .cs code behind files. The business logic is compiled in a file called BLL.dll
Up until now this has been fine, as I've only needed to make fairly superficial changes, that could be done by editing the .aspx or codebehind files, however, no I need to make a small change to a method contained in BLL.dll file. I've been able to decompile the files using DotPeek and can copy the code from the class file I want to edit. From what I've read, recompiling decompiled DLL files isn't advised (if even possible at all).
My question is, can a single file from this DLL be used as a standalone class file in my App_Code folder, or will there be dependencies within the DLL that can't be accessed by a standalone class.
I've tried creating it as a standalone class file, but am getting the error that 'System.Transactions' could not be found, although it seems to be working when it's referenced in the compiled BLL.dll file.
I'm a novice at .NET, so please excuse my ignorance.
Thanks
I've worked with PHP but never C#, and I need to make 1 change to a file, and was hoping I could get some guidance, or suggested resources to learn more.
I have 1 cs controller file where I want to change the [Authorize(Roles="A")] to [Authorize(Roles="A,B")]
I made the change but nothing happens, so I've come to the conclusion that this cs file probably needs to be compiled.
The question is, is there a way to compile this one file? Or does the entire site need to be compiled?
When I open the cs files, it opens with "Visual Studio Tools For Application 2.0 2008".
Is this sufficient to make the changes?
My thinking is that one of the following needs to happen:
Scenario 1:
Open the .cs file in the appropriate compiler (of which I do not know
what it is) Compile it and copy the newly compiled file into the
appropriate folder.
Scenario 2:
Open the whole project in a compiler - of which I'm guessing the
".csproj" file to open. Compile the whole project Copy the desired
compiled file to replace the old file.
Scenario 2b:
Open the whole project in a compiler - of which I'm guessing the
".csproj" file to open. Compile the whole project Copy everything
back to the server.
Scenario 3:
The code I have is not sufficient to do the changes, and I need some
other source code.
That's all I've got, if someone can suggestion which one(s) may be on the right track, and how I may go about doing this, it would be greatly appreciated.
Thanks
The fact you are talking about a Controller would strongly suggest you are working on an ASP .NET MVC project. You will have a .sln file which is a solution file which is the master document if you will:
YourWebsiteSolution.sln
YourWebsiteProject.csproj
YourController.cs
Once you open the .sln file with Visual Studio (you need to know what version but you can get the latest here: Download VS2012 Web Express). You can the choose Build -> Build -> ReBuild Solution from the menu and that will re-compile all of your .cs and associated files into DLLs that will be in your \Solution\Project\bin\Debug folder (or Release depending on build).
When you deploy to the server you only deploy the .DLL files (in this instance). You NEVER deploy the actual .cs files as they contain the code and you don't want people peeking into them (this differs from PHP where the code is on the server).
Because you have not changed any of the views you don't need to follow this step but for a full deploy you would also copy any .cshtml or .aspx files and the usual suspects such as .css and .js etc to same folders on server as on the project.
I hope that is a good starter to get you going?
Is it simple or even possible?
Why: Following my other question and using this approach, now I would like to simply embed the source file to the resources so I can copy it to the temp folder while the application is running - and keep the application as a single file.
I assume using a pre-build event is the best way to do this. If so, how would it be done?
EDIT: I'm asking about adding it before building because I also assume it won't be automatically updated if I add it manually once and then change the code after.
I recently went through this same issue when developing an examples suite for a .NET control which had to display its own example source code in the application.
The approach I ended up with was as follows.
I created a batch script (run in pre-build) to copy all the code files under /Examples/* to another folder in the solution Resources/ExamplesSrc/*
I then included all these files under Resources/ExamplesSrc/* in the csproj and saved it.
The next step was I set all the files under Resources/ExamplesSrc/* as embedded resource and committed the change to SVN. I did not commit the examples (generated) to SVN, just the modified csproj and batch file.
The effect when developers checked out was that they had (!) icons on all the resources (they were not on disk, but the csproj was looking for them), however as soon as they built the generated files appeared and all was well. This approach also worked with a build server (Team city) and the examples suite can now load and browse its own code via embedded resources.
One caveat you should be aware of. There is a quirk (by design apparently) in VS2010. If an embedded resource has ".cs" in it (i.e. any code file!) it cannot be loaded from the assembly using Assembly.GetManifestResourceStream(). To work around this all source files were renamed in the batch copy step from *.Xaml.cs to *.Xaml.c.txt, from *.cs to *.c.txt
Hope this helps!
Turns out I don't need to (re)add the source file each time I build the solution!
When I add it manually once it becomes a "Text" file on resources - and I can easily access it as a string using Properties.Resources.SourceCode (having the file named "SourceCode.cs"). And yes, it is updated automatically since the resource property "Persistence": the file is linked at compile time.
I have a website and i can open it with the VS 2010, but it has been compiled, i cannot find the app_code folder and the aspx.cs files. now i wanna see them and make some changes myself. I don't know how.
I know how to do it on a pure dll with the help of the reflector.
Does anyone here help me. Many thanks.
Not sure how you'd modify the compiled asp.net website, but here's how to find the dll's.
In your asp.net site you have for example an file called index.aspx, in your bin Directory there should be a file called something like index.aspx.abcd1234.compiled, open it with Notepad and look for the text assembly="App_Web_y5emcutv", that's the name of the compiled code's dll, just look for that name in your bin directory and open the dll in reflector and look for the ASP namespace.
That's it for the code, it would be rather hard to reverse that into a project file though.