I have a .NET 4 website in VS2010 stored in a TFS 2010 team project. I need to add a reference to System.Data.Linq.dll to the website. I am referencing a LINQ DataContext that is defined in another project and I get build errors saying that I need the reference to System.Data.Linq. I go up to the "Add Reference" menu option and add it like I would any normal reference, and it even shows up in the Web.config and in the Properties pages for the website... BUT if I build I still get the same error.
So I found a place in my code where I was referencing the LINQ count function and it told me it was invalid because I was missing a reference and it offered to add the reference automatically. I told it to add the reference automatically and it is at this point that I get the error mentioned in the subject:
TF14040: The folder $/Folder/Subfolder may not be checked out. No items were checked out
I've done some research online but I haven't been able to find much. I saw on a blog that making the folder not readonly fixed the issue for him, but it didn't seem to work for me unless I misunderstood something.
I tried loading up the project from source control onto a fresh computer where that project had never been loaded before and I can reproduce the issue the same way. Help would be greatly appreciated.
FWIW, this error also occurs in different circumstances. I had the same error today from the command line when trying to use tfs checkout SomeFolder /login:user,password, although this was not within the context of an asp.net app, I'm currently working on dependency replication. For me, adding the /recursive command worked, like this:
tfs checkout SomeFolder /recursive /login:user,password
The hint to try that came from here, by the way.
I have no idea if this is your problem but I've noticed that TFS2010 seems to have some bug somewhere around folder renames/deletes/changes or something. The bugs seem to go away when you check everything in and try again after the folder change has been saved to source control. I have hit this issue a dozen times this week but don't know exactly what the scenarios are. It's quite frustrating.
I figured it out, but it's a little strange. I had some build errors that I hadn't fixed yet, also my web.config file used to be for a 3.5 SP1 site and I upgraded the site to 4.0. Somewhere along the line the build errors and the web.config combined to form this strange weird error that apparently has nothing to do with TFS.
I figured it out by creating a new website and slowly moving over portions of my site to that new site. Things didn't go totally crazy until I moved over my web.config. So I went back and updated my web.config file so that it more closely matched the way a .Net 4 web.config should by trimming out a lot of stuff and now things are good and building fine. Thanks for the help.
Related
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
When building my web app, I get the following message (amongst 77 others, all similar, just for different elements in my web.config)
Could not find schema information for the element 'setting' VS 2015 ASP.Net
I have looked at the schema for the config,
looks Ok to me?
I have also other weird stuff going on, like When I add a new webpage, I get an HRESULT FAIL COM error. Ditto with trying to install NuGet packages.
This only started happening yesterday, on a large solution. I had reference errors after a merge, which I have now fixed. All projects target the same .NET version (4.5).
I have no build errors and everything works, except my recent work - a page that uses partials (worked fine until yesterday!). My colleagues are beginning to doubt me!
Does anyone have any ideas?
Deleting the 'bin' folder, then rebuilding seems to have cleared the messages.
Hey guys,
i have a website, i want to place the compile code on the production server, now i took the code on the local machine and trying to compile source code on local machine, but whenever i compile the code, in one of my control(ascx.cs) file i am getting error that the control does not exists in current context, i checked everything, Inherits, CodeFile, even in the code behind(.cs) file, everything is perfect, even i get the control id in the intellisense, when i remove the control and again add the same using intellisense, the errors gets removed but after i publish site, the same error comes again....
Please reply with some suggestion/solutions.
I've had this issue before when referencing another project. It would give it intellisense, but then trying to compile would cause errors and take away intellisense. Removing and re-adding it would give me intellisense back.
The problem ended up being the target framework. The project was referencing .NET 4 Client Profile, whereas the project it was referencing was just .NET 4. Apparently this difference is subtle enough to trip up visual studio in the confusing way described above.
So take a look at your project's target framework, maybe you'll get lucky.
Definitely check your Inherits or CodeFile. I've had this happen before where I had them pointing at the wrong files.
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.
I have a solution with several projects in Visual 2008, let's say SuggestionProcessor (a class library) and Suggestions (a website) with a webhandler GetSuggestions.ashx. I changed a method in SuggestionProcessor which is used in the webhandler. The call in the webhandler has been adjusted to the changed method.
But now when I try to execute the webhandler after a rebuild I get an error that the method I changed is missing, displaying the old method signature. When I try to rebuild the entire project it seems that the website does not rebuild properly and the code I changed in the webhandler does not seem to be included in the rebuild. I made sure that the website is last in the build order.
What I tried is remove the dlls that the build process should rebuild from the bin folder (not the ones referenced from outside the website). When rebuilding I now get a: 'could not load type Suggestions.global'. Duh, that is what the build process should create. What is going wrong here?
I solved this one by reverting to a previous state when it still worked.
Thanks for the suggestions, I'm sorry they didn't work in my situation.
Shall I delete this question now that it doesn't really have a clear use for someone else?
I would check your web.config file, there may be references there that are causing the error since they are missing.
Maybe try and right click on your solution and select "Clean solution" and then try and rebuild all.
If that doesn't work, check your solutions build configuration and make sure all your projects are getting built
Try "Clean Solution", then building SuggestionProcessor, and after that clean and rebuild the web solution.
Visual Studio creates a copy of all your DLLs and sometimes this copies are not refreshed.
Just execute iisreset and delete all folders in:
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET Files\
Of course change windows installation folder and framework folder to your version!
I don't think so... I've seen similar issues in Visual Studio 2008 working on web projects where the build and rebuild would fail time after time. I knew that my changes shouldn't have affected the build so I just kept cleaning and building each of the individual projects in my solution until finally (and I do mean finally as in, it took up to 10 builds) my web project would build correctly. I have no idea why, but it feels like some sort of caching issue.
From my answer at "Could not load type [Namespace].Global" causing me grief:
It seems that VS 2008 does not always add the .asax(.cs) files correctly by default.
In this case, refreshing, rebuilding, removing and re-adding, etc. etc. will not fix the problem. Instead:
Check the Build Action of Global.asax.cs. It should be set to Compile.
In Solution Explorer, Right-click Global.asax.cs and go to Properties. In the Properties pane, set the Build Action (while not debugging).