I updated the dll references in my mvc3 site. they are the same dlls but different versions. I did this by first deleting them, then added the updated ones. All compiles properly. However at runtime, I get runtime errors of cshtml files not being able to reference some namespaces. When I open these cshtml files, the vs2010 does show an error of undefined namespaces. BUT the same namespaces work fine in codebehind cs files. In the respective view web.config file. I have tried:
<namespaces>
...
<add namespace="myassembly" />
</namespaces>
or
<controls>
<add assembly="myassembly, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="myassembly" tagPrefix="myassembly" />
</controls>
I still can't rectify the problem in my view. When I revert to old dlls version, EVERYTHING works fine and I don't need modification in view web.config. It seems like its a case of the view still trying to reference the old dll version, hence it can't find them when I update to new versions.
How do views reference dlls?
Thanks
You have to use the web.config file that is inside the Views folder, not the one that is in the root directory of your project.
Related
I have a project with crystal reports version 13 that I am running as part of an MVC 3 .NET application.
We have 4 existing detail reports that work correctly.
The problem is that I need to create a new report that has charts, and I cannot get the charts to display at runtime, although they will display OK at design time.
This is running locally in visual studio (not in iis).
The problem appears to be because crystal reports generates a file dynamically called crystalimagehandler.aspx, and for whatever reason this isn't being generated on my computer
When I run process monitor as thereport is being generated, it produces the following output:
10:01:40.1814627 a.m. WebDev.WebServer40.exe 1692 QueryOpen D:\tfs\chad\Main>\Src\chad\Chad.Website\Reports\CrystalImageHandler.aspx NAME NOT FOUND
I have added the following lines to my web.config
<httpHandlers>
<add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
</httpHandlers>
(and in system.webServer)
<handlers>
<add name="CrystalImageHandler.aspx_GET" path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode" />
</handlers>
Does anyone have any other suggestions?
The problem was that because this is an MVC Application, I had to tell it to ignore the route to the reports folder. I found the solution in this thread Embedded images not displayed in MVC application
I added the line:
routes.IgnoreRoute("Reports/{*restOfUrl}");
to my Global.asax, and that did the trick.
Note that the web.config setting to add the httpHandler is also a necessary pre-condition for getting the images to display.
this post is intended as (not optimal) solution for everyone that has to struggle with the same problem and there is only few to no answer in the net atm...
(of cousrse this post will contain information from other sources)
we had problems with custom data type mapping (number) in our project (VS2010/EntityFramework/WCF RIA Services/Oracle ODP.NET) which we were able to solve the following way:
we had to use the following custom oracle number mapping information (because of legacy DB)
</connectionStrings>
<oracle.dataaccess.client>
<settings>
<add name="int16" value="edmmapping number(4,0)" />
<add name="int32" value="edmmapping number(9,0)" />
<add name="int64" value="edmmapping number(17,0)" />
</settings>
</oracle.dataaccess.client>
we put this information in App.Config within the project with the EDMX file(s)
now we were able to create our EDMX files with the custom mapping
1) there was a problem that when you restart VS2010 it can happen that upon proeject compilation it wont compile because of an Error 2019, this error is of course related to our custom mapping and its a "VS2010 bug???" maybe but one solution is to open he VS2010 about window then close it then compile... but the better solution might or might not be to add the same information we added to the App.Config file to the devenv.exe.config file...
now we can compile the EDMX project and
the My.Service.Web (.NET) project that uses the our EDM
2) there is still another problem ... the WCF RIA Service My.Service (SL5) project
has no idea of the App.Config settings so when we try to compile it we will also get the
Error 2019...
adding the mapping information to the Web.Config file did not help
but when we add it to the machine.config file we can finally compile...
SUMMARY: add the mapping information to
App.Config (where your edmx file is)
Machine.Config (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config)
Web.Config (in your web project, not sure if required since we added it to Machine.config)
QUESTION: isn't there a better solution than to add it to Machine.Config?
I really hope someone has a better one because it will probably restict
development of other projects...
hope this helps and hope for a better (re)solution
thx and cheers
versions:
VS2010 SP1
EntityFramework 4.1
WCF RIA Services 1 SP2
Oracle 11g (ODAC/ODP.NET 11.2.0.3.0)
I had to rebuild the Krypton.Toolkit.dll from it's source in order to remove a license error message on runtime. In the references I have removed and replaced the old Krypton assemblies with the ones from source.
I am now getting the error: (and a related cast type error)
Could not load file or assembly 'ComponentFactory.Krypton.Toolkit, Version=4.0.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e'
I understand the error message. Although the my new reference has the same name it does not have a strong name at all, so there is no PublicKeyToken.
What I don't understand is why it's still looking for the old PublicKeyToken when the reference is being replaced completely? This DLL is not in the GAC.
At first these DLLs with matching PKT where referenced in my main projects .csproj file. I gave my two assemblies a strong name and replaced the old references.
I have then cleaned and rebuilt the project and the new strong name has been replaced in the csproj file. However Visual Studio is still looking for a87e673e9ecb6e8e in the aforementioned project, as shown in the error window.
Sorted.
A reference was referencing the same 3rd party DLL as my project and they where conflicting.
Something in your solution seems to still hold a reference to the strong-named version.
You can open your .csproj (or I think .vbproj if you're doing VB) and look for that reference in your favorite text editor. Look for a line similar to:
<Reference Include="ComponentFactory.Krypton.Toolkit, Version=4.0.0.0, Culture=neutral, PublicKeyToken=a87e673e9ecb6e8e, processorArchitecture=MSIL">
</Reference>
Searching for the PublicKeyToken is probably sufficient.
If you find it, you will know which project still references the strong named version.
You may see a sub node like
<Reference ... >
<HintPath>..\SomePath\ComponentFactory.Krypton.Toolkit.dll</HintPath>
</Reference>
directing the linker to look in a specific path to resolve the reference.
You can manually edit the project file (back it up first), or use that knowledge to update the reference through VS if you're more comfortable with that.
UPDATE
If it turns out (as it did in this case) that the issue is with a referenced DLL that in turn references the other Krypton version, a good tool for diagnosing the issue is the Fusion Log Viewer
http://msdn.microsoft.com/en-us/library/e74a18c4.aspx
Note that Fusion Log Viewer must run as Administrator. If not, it will not show any results but will otherwise not complain.
I'm deploying an MVC3 project that began life in the old days of xVal. I think that's the root of this error:
Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have the same webapp running correctly on the production server - a win08 (pre-R2) box that served the v1 version of the app. Now I'm moving to a newly provisioned R2 box and find that any page referencing xVal is tossing the above error.
Is there a way to transfer the older dll(s) without digging thru the asp.net/mvc site for an old distro? I'd really like to avoid touching any bits of the validation system right now.
thx
ADDENDUM: Initially the pointer to Phil Haack's post seemed to solve my problem - but re-deployed today and having the same issue with this additional info.
I'm using ELMAH to log the app's errors and the source being reported to ELMAH might offer a clue. Instead of the SOURCE property being something like 'NHIBERNATE' or 'SYSTEM' or my assembly's name i'm seeing 'App_Web_b1pe5vbs'. The log has a handful of these oddly named Sources. Any thing to see here?
thx
in vs2010 you could now right click on the MVC3 project, click on "Add Deployable Dependencies" and select ASP.net MVC checkbox, it will add required assemblies in _bin_deployableAssemblies folder.
I need to config IIS-Express (or DevServer) to put all output assembly files in one place.
Now DevServer copies each dll to its own folder like:
C:\Users\UserName\AppData\Local\Temp\Temporary ASP.NET Files\root\3df2e06f\587c7c63\assembly\dl3\fea77c7a\42e614aee75dcc01"
I need this to enumerate assemblies, and load plugins.
Three month ago I managed to find special key to app.config, which helped.
Does enyone know this magic app.config key?
Finally found:
<system.web>
<hostingEnvironment shadowCopyBinAssemblies="false" />
</system.web>