在C#工程中设置Reference的相对路径
来源:互联网 发布:图论算法对比 编辑:程序博客网 时间:2024/06/13 00:37
要在C#工程中根据不同的项目配置使用不同的 reference,而该 reference 路径是相对路径,这时我们可以修改 csproj 项目文件,在其中添加 reference 路径,如下示例:
<ItemGroup>
<Reference Include="System" />
....
<Reference Include="log4net" Condition="'$(Configuration)'=='Debug'">
<HintPath>..\..\..\..\..\Output\bin_debug\log4net.dll</HintPath>
</Reference>
<Reference Include="log4net" Condition="'$(Configuration)'=='Release'">
<HintPath>..\..\..\..\..\Output\bin\log4net.dll</HintPath>
</Reference>
</ItemGroup>
Notes:
log4net 在.Net 4.0 中会报异常:
Inheritance security rules violated while overriding member: 'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being
可以在 log4net 工程中的 assembly(文件 AssemblyInfo.cs)里增加如下一句,重新编译即可:
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
- 在C#工程中设置Reference的相对路径
- 在C#中相对路径
- JAVA 工程中相对路径的写法
- 【C#】在C#中获取相对路径
- 在iphone工程属性设置时,使用相对路径
- 在java工程中java类相对路径问题
- vb.net中相对路径的设置
- vs中相对路径的设置问题
- C# 中获取项目的相对路径
- C# 中相对路径、绝对路径的问题
- C# 中相对路径、绝对路径的问题
- 绝对路径和相对路径在javaee工程下的区别
- source_insight工程的相对路径
- source insight 工程中配置相对路径
- ImageIcon的相对路径设置
- PHP中工程的路径设置
- C# InstallShield打包设置相对路径
- ASP.NET程序中设置相对路径的方法
- php .htaccess文件使用详解
- C#多线程|匿名委托传参数|测试您的网站能承受的压力|附源代码
- 套接字绑定失败:已被占用问题
- Java 依赖注入标准(JSR-330)简介例子
- Linux设置环境变量小结
- 在C#工程中设置Reference的相对路径
- 强大的PHP发邮件类
- windows资源管理器停止使用
- 91无线发布国内Android应用数据
- myBatis + SpringMVC上传、下载文件
- Entity Framework 4.1乱抛EntitySqlException的BUG
- 自定义 UIPopoverController
- 解读HTTP与HTTPS的区别
- 文件上传类