referencing umbraco 7 source codes - asp.net

I am trying to figure out some of the functions inside umbraco. The documentation is pretty awful. Can't even find some of the basic example functions definitions.
In example no documentation for creatRegistrationModel, https://our.umbraco.org/search?q=CreateRegistrationModel&cat=documentation
So I found the github downloaded the project. Compiled without issues. I know i can reference the files which i have done for umbraco.dll but not using the file directly, seems pushing it to Temp folder.
Now I want to reference the solution's project .dll files. And debug step by step into the code, is this possible? if i can go tru the code I could see how its calling some of these functions what kinda actions its taking.
Or should I move the projects into my project and reference inside there giving me single project to manage. not sure even if it would work.
Any suggestions?

Related

Class in App_Code folder not accessible in vb.net website project

At work I have been asked to make some amendments to a vb.net website project i've not worked on before. I've cloned the code from TFS and opened it in VS2019 but there were errors when I tried to run it. I know the website runs because my colleague has been working on it, and it is also live on a server and being used by our clients.
I have fixed some errors in the web.config and added some missing references, but now i'm getting an issue with a class called Translation which is in the App_Code folder. The class is used all around the website but i'm getting the error:
Type 'Translation' is not defined.
All of the solutions i've come across say that I need to change the build action on the class to 'compile', but that isn't possible for a website because there is no build action property. The other suggestion i've seen is to add a 'using' statement but as the class has no namespace this is not an option.
I've seen lots of people asking how to do this for websites but nobody has provided an answer, so i'm hoping someone out there can finally come up with a solution which can help me and anyone else struggling with this problem.
There is often a problem with app_code. In fact two fold. First up, is IIS will compile the code in that folder and NOT Visual Studio. This can lead to problems on deployment (some (a lot) of web sites don't have the newer rosylin complier, and I find some of the great new features (such as free form strings in code) will not compile.
But expand the app code, and then right click (properties) for say the given class, or module code you have, and change/set this: (build action)
Change above "build" action to compile (if it not already).
And even before you do above, try a re-build all (that often fixes this).
So, change above - it possible that the code/module you added to app_code not been (ever) compiled, and thus not seen in your project).
So, I actually now often create my own folder called "MyCode" and often avoid the issues of app_code. However, you might be dealing with a existing applcation.
You could also try doing this:
Rename app_code and add it again:
eg:
but, I would first try setting the code module/or class in app_code to compile in the properties sheet first. And try a re-build all.
In fact, exit VS, re-load, open project. rebuild all. Do that first, just in case (since then you don't make any changes). If exit/reload don't work, then as noted, right click on the module/class in app_code and set build action to compile.
And last but not least, you could try a re-name, and add the app_code folder - since it a specials .net folder, and manually adding that folder often does not work (don't just add folder - add "asp.net" folder) - you need to let VS add it for you as per above screen cap.
After many painful hours i've finally got the code running - mostly thanks to the efforts of my colleagues and my boss. It seems the existing project wouldn't run for me so my boss created a new project and added the required websites to that. After some fiddling with the configuration he got it working.
So unfortunately I cannot provide an answer. Apologies if you've arrived here looking for one. I'm not sure this is actually an issue anyway as I never found anything about anyone else having the problem.
Thanks to Albert D. Kallal for trying to help

Custom path for folder

How to add a reference to the App_code directory for a sub-folder in web project
I have been given a task to take an older, grown piecemeal over a decade internal website and bring it "up to speed". I have run into a problem in ASP files to "see" the app_code directory. Essentially the current site is a collection of folders that work(ish) that I am trying to collect together as a single project with the LEAST number of edits.
When functionality was superseded the old code was moved into a "deprecated" folder. The code files now reference object in the app_code directory which is not visible to the file from it's new location. The easy answer would be to copy a version of the class file into the "deprecated" folder but that seems more like a hack then a solution. The same for copying the App_code folder to a location visible to the ASP file.
My thought was to add a reference ("reference path") somehow to the deprecated folder pointing to the app_code folder but I cannot find how to do that.
A couple of other notes: 1) the site was built by using text editors and "freebie" editors - it has never been compiled or run in-total through VS before. 2) once I get it built and checked into TFS I am going to remove the deprecated folders. 3) I am working under some stipulations to satisfy concerns arising from actions of prior developers.
Code like:
tr.Controls.Add(GUI.GetTableCell("Salesman", 0, "Center"));
Works well when the ASP page is at the same directory level as the App_code folder ("GUI" is a class with a "GetTableCell" function).
If I can add a folder reference I can solve all of the remaining problems I have with this step in the project.
EDIT
Let me re-ask it this way. The image below is a composite of what I am facing in VS2017. I have such a feeling that a light bulb is simply not turning on for some reason. How I have done this so far is pulling down the current website from our internal Win2003 web server and am trying to convert it into a legit web project. I have done many of the steps necessary but there are 47 instances of the problem visible in the composite image from Visual studio
The code behind from SubscriptionEditor.aspx pictured lower right. Has reference to a namespace which is in the code files in the App_code folder (neatly hidden). This site functions fine but I am missing something to make it work from within VS. I am just at a loss.
For anyone that finds this I want to point out that there are a number of excellent answers available for similar questions here and i have looked at dozens and tried them all. The simple answer to my problem is "you can't".
How to convert ASP.NET website to ASP.NET web application came close
The problem being the source is just a collection of ASP files - it follows no project or template.
Namespaces are super important in development and the clever ways that prior developers found to breach that discipline can not be fixed through VS. It is simple a lot of bloody knuckle corrections of code and scope issues til the errors disappear.
The limitations put on me prohibit any solution. I will end up advocating not "saving the code" unless they are willing to put in the investment to heal the most egregious foibles. So if you see me in the "available for contract" sites then you know how that conversation went.

Preview Failed - Visual Studio will look for typescript files when publishing even when they are not included

I'd like to do the inverse of this question/answer:
How to include TypeScript files when publishing?
The thing is that I'm trying to publish an ASP.NET MVC 5 Project. Unfortunately the dreaded Visual Studio and the hungry Jack Typescript interpreter ignores any tsconfig.json file and decides to go deep down and look for any .ts file that is not accompanied by a .js. I have lots of npm packages nested down and some of them have uncompiled typescript files.
Funny thing is, that they are not included in the project (not even an exclamation mark). (I even checked for the .csproj and no files were found).
Is this a bug? How can I prevent this from happening? Using VS 2015.2 (Update 2).
I had a very similar issue. Publish kept failing because it couldn't find foo.js as it wasn't in the same directory as my ts/tsconfig files, even though outDir was set to another location. I don't know if it is a bug or not but I couldn't figure it out using the tsconfig. Instead, I was able to get things working by using the inbuilt TypeScript Build settings instead.
First, I deleted all tsconfig files from my project (I made sure I kept a backup just in case). The TypeScript Build was originally greyed out because I had the tsconfig files in my project.
Next, I created a new folder directly under Scripts to save the js files into.
I then went to Project Properties and selected the TypeScript Build tab. Under Output, I checked the Redirect JavaScript output to directory and browsed to the newly created folder. I repeated this for all build configurations.
Finally, I included the new folder in my project and then built. Folders and files which aren't included in the project can be seen as a ghost icon in the Solution Explorer if you have Show All Files icon selected. I think that if you have multiple TypeScript projects with their own tsconfigs, the file structures are replicated under the chosen output directory but I haven't tested it in many cases so I'm not certain.
Obviously I had to redirect my script bundles to the newly created js structure.
When I first followed this process, I got a few build errors mainly due to my own daft mistakes in my TypeScript code which I'd set the tsconfig to conveniently ignore. Another error was multiple references for objects, which I managed to fix by deleting the definitions files and making sure that the Generate declaration files option was unchecked in Typescript Build. Once I fixed those issues though, I was able to publish without that annoying error - happy days!

Creating project from existing IIS/ASP.NET website, building stuff

So I'm left maintaining a proprietary codebase from a third-party vendor. The vendor is still sort of around, but support is limp. The site is ASP.NET.
I have made some changes but I am having a really hard time getting IIS to compile these changes in. The bin/ directory has what I believe is a precompiled dll for the core classes. I've changed these but it doesn't recompile. I have tried deleting the dll but then the app refuses to build saying that the Global.asax can't inherit the type anymore, so I don't really know how to rebuild with changes.
I spent all day Saturday setting up a build environment and trying to get a testing thing working. I have just been importing into VS2008 as a web site from the local IIS server. I got it to rebuild the app without changes, but it ignores changes I would place in it.
So I need to make a solution out of this website and/or directory structure so that I can do actual, big, full grown-up rebuilds and make changes to this codebase. Anyone know how I can go about this?
EDIT: A bit more elaboration. I've tried creating a blank project and just Add Existing File... on the whole website directory. This hasn't worked, it stops the import about 10% in.
Keep in mind there are two (actually, three) levels of 'builds' or compiles going on here.
1) The DLLs in the /bin directory should be pre-built, by visual studio or otherwise. The content of .ASPX, ASCX, ASHX, ASAX etc fiels are not included in those.
2) The ASPX, etc files I noted above are then compiled by IIS when the first request comes in (normally; there are ways to change that behavior). That is the source of the error with Global.asax you are seeing; With the DLL(s) gone, the class that Global.asax is supposed to inherit from does not exist.
3) Then there is the just-in-time compilation, which is not relevant for this discussion.
It sounds like you may be missing the source files for the project, or perhaps the web site is not getting properly set up as a project to compile that DLL
Try these links, I suppose this is what you are looking for.
http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2010/01/20/linking-files-in-visual-studio.aspx
http://support.microsoft.com/kb/306234
Not sure this question is really valid anymore. The source we were working with was rather different than it should have been. Not sure if someone got angry in the past and moved stuff around or what, but grabbing a new copy of the source fixed most of our issues. I am able to build now with an included csproj.
This doesn't really help many others with the same issue I suppose, but if you are getting weird build behavior like this, you might want to start with basics, like making sure that your source checkout is valid.
I am new in asp.net so I am not sure it is a professional way or not.
I have the project without .snl file. I just create a empty web site and then paste the files inside the folder where I created the project.
It worked for me.
I think pasting the files and folder directly by file manager will help you.

Flex Builder not building new source code

I have imported an existing project into flex but any changes I make to the source are not being built and displayed when I test run the application. The original files which are in the bin-debug folder dont seem to be changing at all.
I have tried cleaning the project, deleting the bin-debug folder even reinstalling flex builder, but nothing has solved the problem.
I've read this post which was about the same problem but none of the advice helped.
Any advice would be appreciated.
When you imported the project did you do a default import (copies everything into your workspace) or an "Existing Projects into Workspace" import?
If you did the default (listed as "FlexBuilder/Flex Project" under the import source) then you might be changing the wrong code. If you're looking in the original project's location for the SWFs to run then you're in the wrong place, as the SWFs you build will be in the new location.
One quick way to test to see if your code is actually being compiled would be to intentionally put a compile error in there. If the compiler chokes on it then your code is being compiled.
There's another thing you can try. I just ran into a weird issue where FB was caching a compile error, and even after fixing the file it still showed the error. Even after doing a clean, restarting FB, etc.
I found a place where FB caches information for the project, and for some reason it wasn't clearing things it should. It's possible your project's cache got messed up and it's messing up the compile somehow. You can try deleting it (might need to delete and re-import your project though).
The cache is at:
workspace.metadata.plugins\org.eclipse.core.resources.projects\
I just made a blog post about this, in case you'd find it useful.

Resources