I'm working on a web app using VS 2008, .Net 3.5 and C#. Most of the projects in the solution are either classic asp.net pages with some MVC 1 in the mix, the rest is shared libraries. The solution is one that is some 5 years old and has gone through a variety of developers working on it and clearly has some performance and architectural issues.
Previously, I've been working on the project using VS 2008 on a Win XP machine, but have just transitioned over to a new box using Win 7 Ultimate. To do so, I've installed VS 2008, asp.net 3.5. To support future work on the solution I've also installed VS 2010 and asp.net 4.0.
Opening the solution on the new box with VS 2008 works fine, and it builds without error. However, when I attempt to run it with the debugger, I get the following message:
"There is an error in web.config. Please correct before proceeding. (You might rename the current web.config and add a new one.)"
I think it's clear that there is some sort of environmental issue regarding web.config on the new machine, but the error message is not "helpful". Adding a new web.config is not an option as the existing one is quite long and involved (too much to post here).
I'm hoping someone has a suggestion or two about where I might look for missing elements or changed configurations that might produce such an error message. Lacking that, I'll revisit this post and provide the web.config in the hope that will elicit further help.
So I don't know if you ever found an answer to this, but I ran into it in VS2013 today. Oddly, it would work if I had the web.config open in an editor window.
For others who may see this error I was able to clear it in VS2013 by deleting the \bin and \obj directories.
After that, it worked fine again...
To maybe give you a better idea of what the web.config problem is, I would follow the suggestion of renaming the current one and adding a new one. You can use a diff tool (e.g. WinMerge) to find out what the differences are between your existing config file and the "clean-slate" new one.
You can copy the non-issue sections from the old one to the new one, like the connection strings and the application settings, forms authentication modes, etc. You might have something wrong with the compiler section or something a little more specific to the .NET framework.
Did you convert the project at all from targeting .NET 2.0 to .NET 3.5? There's a big web.config section that gets added to 3.5 projects that wasn't required for 2.0 projects regarding the compiler, as it uses a separate compiler for .aspx inline-code than was used for 2.0.
iis 7.5 (on windows 7) is a pretty different animal than iis 6 (on windows xp). there are some configuration incompatibilities. one thing that comes to mind is a little different schema for the attributes on the elements for http handlers and modules. there are other things that are different. usually on the error page, it will tell you what it doesn't like. i imagine it was there and maybe you didn't notice it. or maybe you were hitting the page remotely and it didn't have all the detail. i suggest using a browser on the local machine and take a closer look - pretty sure it will tell you what is making it puke.
I ran into this ambiguous error for the first time today in VS2019. I had added a new Entity Model (.edmx) which required adding a new connection string to a separate project's web.config. After adding it, I immediately started getting the error on startup. I noticed there were several config transforms for the various environments. After adding the missing transformed connection strings to each of them that error has gone away.
Related
How it's supposed to look (and does look on one machine):
Then, when moved to another computer, this is the result. As if the layout and CSS is not rendered, but it seems to render when going through it with breakpoints:
Both PCs run Visual Studio 2017 with .NET Framework 4.5.2 and the files are identical on both. Any ideas where I should be looking to fix this, that'd be litty.
When this problem occurred for me it was a problem with IIS... On the second computer, open up Windows Features and ensure that the following option is checked:
Windows Features
Correction: It was a problem with allowing IIS to serve static content.
I shouldn't bully IIS and needlessly blame it for things.
I recently upgraded an old C# application to 4.6 framework so that I could consume a vital service that was moving to 4.6. After I did that my fckEditor had 102 compile errors. This did not make any sense because it had been working just fine for years. So, I upgraded to CfEditor and I still have 102 errors.
An example of one of the errors is:
'addedCount' is not declared. It may be inaccessible due to its protection level.
I have that type of error around 20 times.
All the errors are in the CFEditor code. Any advice on how to fix this?
Did you change the target framework version for the package? Try doing that and cleaning and rebuilding your solution. If you're using Visual Studio, this has caused me problems in the past after applying a dramatic change like updating framework version. Try restarting the editor as well.
I am assuming that this place you're having an issue with is resolved via a package manager. Please give more context if this isn't the case.
Thanks for replying. Last night, right before I stopped for the day. I removed the folder and the DLL and then added everything back in and Walla! Everything worked. It looked like the folder that I removed had stuff in it that didn't belong.
I have a rather confusing issue.
I've recently picked up some code I wrote 8 months ago in VS Web Developer 2008. Ive now moved on to 2010, so I upgraded the project, but otherwise it's the same. It now won't build because of code like below:
IMSDataSet.vwPartDataTable table = new IMSDataSet.vwPartDataTable();
da.Fill(table);
//Convert to Parts
return table.Select<IMSDataSet.vwPartRow, Part>((row) => { return new Part(row); }).ToArray();
Where vwPartDataTable is created using the Data Set designer in Visual Studio.
Now having a look around on SO it appears that this is incorrect code, and I need a AsEnumerable() in there. However the thing is. I deployed this code. There's load of these lines, I used them everywhere, so it must have worked.
The project upgrade moved everything to .NET 4.0, but putting it back to 3.5 had no effect.
Can anyone shed any light. I'd prefer to keep the code exactly as it was because that is what the customer has.
Thanks.
If that was a .Net 2.0 feature, you can target that framework version in Visual Studio 2010 if you take an extra step described in this popular SO question.
To answer this. I had incorrectly installed some SQL component. I got an error when trying to open my .xsd (the drag-and-drop data table designer), involving a missing package. This fed down into the custom tool generating old or basic code that didn't include generics support, therefore the generic LINQ functions I used weren't available.
Fixing this required uninstalling Visual Web developer and .NET 4, then re-installing. I also installed SQL Server 2008 R2 express separately instead of letting the Visual Web Developer (VWD) installer do it. This is what I've done previously as well.
We have got a C# Windows application which uses devexpress controls, enterprise library and CC.net for building. We are planning to migrate VS2010 soon.
Have you come across similar situations? Are there any unforeseen issues?
If your code makes use of any of these features listed in column 1, you might need to take a look at this:
http://msdn.microsoft.com/en-us/library/ee855831.aspx
If you are still targeting .NET 3.5 then the move should be very smooth. We recently moved a very large WinForms app across and encountered a couple of minor issues:
Some of our resx files contained serialized generic lists of our own custom types, which caused compile errors. Never got to the bottom of why this was, but we just deleted them from the resx files and set the [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] attribute on the offending properties
The syntax checking of XML comments is slightly stricter, meaning you could get extra warnings (and with all warnings as errors turned on this broke our build)
We did a similar migration almost a year ago (just after Visual Studio 2010 was released). That was a little bit too early as DevExpress were not quite ready with their .NET 4 version yet. We had to run the web application in "compatibility mode" for a week or so.
There were very few issues. From what I remember (our product is half .NET and half C++):
Some third party controls needed updating
Some internal names crashed with new .NET 4 BCL classes.
C++ project started to use MSBuild so that was some work up upgrade the project files.
I faced this : on XP machine, trying to build a project referencing a COM with multiple objects inside. Specifically, i've encountered this with INetFwMgr - (The type or namespace name 'INetFwMgr' could not be found (are you missing a using directive or an assembly reference?). Its seems that i am not the only one.
EDIT: solution here.
My C# WinForms solution has two projects.
A DLL which is the main project I'm working on, and an executable WinForms I call "Sandbox" so that I can compile/run/debug the DLL easily in one go.
I'm working in .Net 4.0 for both projects.
Everything was working fine until I added some seemingly innocent code, and a reference to System.Web in the DLL.
Now my Sandbox project can't see the namespace of the DLL project. I didn't change anything which I believe should have affected this.
If I delete the project reference to the DLL from the Sandbox references and re-add it, then the red underlines all disappear and the colour coding comes back for all my classes etc; but as as soon as I try to build the solution, the whole thing falls apart again.
When I right-click the DLL project in the Sandbox's references and view in object browser, I can see the namespace and all the stuff in there.
I have a feeling this might be some sort of bug?
Is this some sort of VS2010 bug? I had this same issue a few months ago and I could only fix it at the time by making a whole new project and re-importing my files. This time, however, I have a bajillion files and will only do that as a last resort!
Edit:
After panickedly going through and undoing all my changes, trying to find what caused the problems, it seems to be this line:
string url = "http://maps.google.com?q=" + HttpUtility.UrlEncode(address);
If I comment out this line, then I get no namespace errors and the project builds fine. I can't see anything wrong with this line though.
I'm ready to declare this a bug in VS2010, this has bitten way too many programmers already. The fix is easy: Project + Properties, Application tab, change Target Framework to ".NET Framework 4" instead of the Client Profile that is selected by default.
System.Web is not included in the client profile. Having this option in the first place is quite silly, the client profile is only 15% smaller than the full version of .NET 4.0. Having it selected by default is even sillier. But I digress.
UPDATE: mercifully this all got fixed in VS2012. Which no longer makes the client profile the default for a new project. And the client profile got retired completely in .NET 4.5, good riddance.
Check to make sure that both projects are using the non-client profile for their target framework (go to each project's properties to do this).
One possibility is that the target .NET Framework version of the class library is higher than that of the project.
I faced this problem, and I solved it by closing visual studio, reopening visual studio, cleaning and rebuilding the solution. This worked for me. On some other posts, I have read the replies and most of users solved the problem by following this way.
Try building only the project with the Sandbox dll first independently.
Then point your executable project to the required dll and ensure copy local is set to true. in reference settings.
Tthen build the executable project.
Changing the target framework from the ".NET Framweork 4 Client Profile" to ".NET Framework 4" worked for me with a similar problem. I agree that the client profile doesn't seem to have much of an advantage to using it. I seem to get nailed with weird errors that I hunt for until I remember that Visual Studio defaults to the client profile. I guess the moral of the story when getting an error is: if "Rebuild Solution" doesn't work, check the Target framework...
If you tried already doing the Framework change, and still not worked, I hope this works for you (as it did for me): Simply add the necessary references from within your projects. Very obvious but I was doing it wrong until I found what was the issue.
I just had this issue and it turned out to be I had multiple namespaces being used that had the same object name (i.e. business objects had the same names as mvc models);
Fully qualifying the names fixed the issue for me.