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)
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.
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.
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>
I am currently working on a MVC3 project with Razor.
I have switchen on compilation of Views to be aware of spelling errors etc. at compile-time.
As soon as I switch on the <MvcBuildViews>true</MvcBuildViews> in the projects configuration file a get the following error during compile:
Error 1 It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
I read several possible solutions to the problem, mostly concerning IIS and virtual Directories or Applications.
The problem is, that I do not use IIS, but instead use the default Visual Studio Development Server.
What can I do to solve this problem?
I have tried a lot of different solutions available in the web, but either they did not quite fit onto my problem, or they did not work.
To recap my problem:
After switching CompileViews on, I immediately got the above error during compile.
I am using the default Visual Studio Development Server of VS2010 to test my MVC app.
Today I opened a request at Microsoft Developer support, and - I am almost ashamed to admit it - got my answer approximately 30 seconds into the callback from the technician:
All he said was: Please goto your obj folder and delete all contents. Then compile again.
And that really was all it took.
So after a lot of head-shaking about myself I wanted to share the results with you.
This problem occurs when there is web project output (templated web.config or temporary publish files) in the obj folder. The ASP.NET compiler used isn't smart enough to ignore stuff in the obj folder, so it throws errors instead.
Another fix is to nuke the publish output right before calling <AspNetCompiler>. Open your .csproj and change this:
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
to this:
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<ItemGroup>
<ExtraWebConfigs Include="$(BaseIntermediateOutputPath)\**\web.config" />
<ExtraPackageTmp Include="$([System.IO.Directory]::GetDirectories("$(BaseIntermediateOutputPath)", "PackageTmp", System.IO.SearchOption.AllDirectories))" />
</ItemGroup>
<Delete Files="#(ExtraWebConfigs)" />
<RemoveDir Directories="#(ExtraPackageTmp)" />
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
That will delete all web.configs under \obj, as well as all PackageTmp folders under \obj.
I have written a code generator using CodeDom and it generates a number of classes from stored procedures. I'd like to add its execution as a build step and then add all of its classes to the solution programatically at build-time.
How do I do this?
Use Custom Build Providers
Subsonic also uses Build Providers to generate its DAL and code. Please check subsonic configuration for custom build provider. It is open source you can check its implementation also.
<configuration>
<system.web>
<compilation>
<buildProviders>
<add extension=".abp" type="SubSonic.BuildProvider, SubSonic"/>
</buildProviders>
</compilation>
</system.web>
</configuration>
It uses .abp extension file to initiate its build provider.
Edit : Yes, Custom build providers are super feature of ASP.Net. But
traditional winform or other
developers can use MSBuild custom
tasks to get the same effect. Dino
Esposito has provided a great article
for the same. You can check it
here.
I don't know how this would work, but here goes:
If your CodeDOM code is generated in a separate project, generate the classes and then add the file names to the .csproj file (it's just XML) of a library. Have it ordered to build first as well. Then have the library's pre-build event run the code generating app, then it will compile. When you click on VS the next time, it will ask you to reload because the project file has changed and your new classes should show up.
It seems a little hacky, but with a little scripting it could be automated.