vs2010-vs2012 running compilation spring.net problem solving

Source: Internet
Author: User

Start learning spring.net, fortunately there are you Daniel's blog, to learn from learning, it is a great benefit, recommended two blog, write Spring.net, personally feel good.

Liu Dong's blog

Http://www.cnblogs.com/GoodHelper/archive/2009/11/20/SpringNet_Index.html

Tony

Http://www.cnblogs.com/cilence/archive/2013/02/21/2920455.html

Own hands to Spring.net source down, ready to follow the tutorial, do it yourself, with the VS2012, do the process, or encounter a lot of problems, some things, it seems very simple, do always have some details of the problem, so must still do;

I slowly comb a few small problems, recorded:

1, about us to learn spring.net the creation of the IOC container object

There are several methods, one of which is the use of a separate configuration file, the object XML file definition used, but also the use of more methods, about the object XML file, generally set as an embedded resource, that is, the XML compile as embedded resources as the best, actually not set as embedded resources, is also possible, You can read the XML object file as long as the program is running;

1 <spring>2     <context>3       <!--the object XML file used by the IOC container in spring is defined-- 4       <!--<resource uri="assembly://assembly name/namespace. folder name/resource name "5       < Resource uri="assembly://sharpcode/sharpcode.config/objects.xml"/>6      </context>7   </spring>8 </configuration>

2. "Spring.Context.Support.ContextRegistry" type initializer throws an exception

In App. Config, comment the following code:

<startup>    <supportedruntime version= "v4.0" sku= ". netframework,version=v4.0 "/></startup>

3, when compiling spring.net, encountered "unhandled Configurationerrorsexception"

    "Error creating Spring/context configuration section handler when compiling Spring.core: Method" Spring.Context.Support.ContextHandler.Create ( System.Object, System.Object, System.Xml.XmlNode) "is safe and transparent, but it is a member of the security-critical type," Google a bit, according to the online solution, After adding the [securitycritical] label to the Create method and the class Contexthandler, the compilation again raises the "override the inherited security rule when overriding the member, the security accessibility of the overriding method must match the security accessibility of the overridden method" error, This is because .net Framework 4.   The three principles of this model are transparent code, safe and reliable key code, and security-critical code. Specific cause of the error, see:

Http://msdn.microsoft.com/zh-cn/library/dd233102.aspx

The workaround is simple, add the following code in the assembly:

[Assembly:System.Security.SecurityRules (System.Security.SecurityRuleSet.Level1)]

Recompile, through ~

Not to be continued ~

vs2010-vs2012 running compilation spring.net problem solving

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.