惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
T
Threatpost
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
月光博客
月光博客
V
Visual Studio Blog
T
Tailwind CSS Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
Jina AI
Jina AI
J
Java Code Geeks
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Recorded Future
Recorded Future
C
Check Point Blog
腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Hacker News: Ask HN
Hacker News: Ask HN
SecWiki News
SecWiki News
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
N
News | PayPal Newsroom
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security @ Cisco Blogs
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cloudbric
Cloudbric
F
Full Disclosure
The Cloudflare Blog
Y
Y Combinator Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
S
Schneier on Security
Schneier on Security
Schneier on Security
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
AI
AI
N
News and Events Feed by Topic
T
Tor Project blog
P
Palo Alto Networks Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More
G
Google Developers Blog

博客园 - cdboy

.Net8新特性 EF Core 中原生SQL、存储过程、视图的使用 EF Core DBFirst 和Code First小结 软件自动发布自动化之配置文件修改 Logstash日志搜集 Windows Service插件服务开源 Linq通用分页数据查询方法 .Net 通用配置文件读取方法 Asp.net 主题中CSS文件的缓存问题 Asp .net 4.0 中ViewStatus 使用 RssTookit使用小结 Windows Live Writer 分享到插件 Windows Resx资源文件编辑工具 IIS 7 中设置文件上传大小限制设置方法 多语言资源文件帮助 转帖:正则表达式的与或非 window service 插件服务插件开发 插件式服务架构 多语言资源工具之制作类库资源文件
vs2010使用PostSharp 1.5
cdboy · 2011-11-01 · via 博客园 - cdboy

转帖:Using PostSharp with Visual Studio 2010 Beta

Published 2009. 07. 16. by jozsef.olcsak

Because PostSharp 2 not announced yet, not available PostSharp installer for Visual Studio 2010. I found a blog entry which contains the instructions for using PostSharp without installing via MSI but it not works on VS 2010.

The first problem was the NullPointerException while building with PostSharp. After I googled that I found something useful. This is a known problem by PostSharp’s developers and the solution is the modify project file:

<PropertyGroup>
  <PostSharpUseCommandLine>true</PostSharpUseCommandLine>
</PropertyGroup>

There is a possible memory leak in PostSharp execution and the "PostSharUseCommandLine=True" forces PostSharp to use command-line utility. "A new process will be created for each invocation, so there can be surely be no memory leak in this time."

The second was that the PostSharp compiler does not work with .NET 4 assemblies at this moment (PostSharp 1.5). So you will downgrade your PostSharp enabled projects .NET version to 3.5. :(

The modified C# project file:

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.20506</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AE544EFB-2842-4A41-BF6C-3038D2046E90}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Bes.Core</RootNamespace>
    <AssemblyName>Bes.Core</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
...
  <PropertyGroup>
    <PostSharpUseCommandLine>True</PostSharpUseCommandLine>
    <DontImportPostSharp>True</DontImportPostSharp>
    <PostSharpDirectory>..\..\libs\PostSharp</PostSharpDirectory>
  </PropertyGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(PostSharpDirectory)\PostSharp-1.5.targets" />
转帖:

Using PostSharp without installing via the MSI

So, it took me forever today to figure out how to get PostSharp working without installing it 'globally' with the msi installer.
In a nutshell, you have to include a directory for example /lib/ with all of the PostSharp baggage:

  • Default.psproj
  • PostSharp.targets
  • PostSharp-1.0.targets
  • PostSharp-1.0.version
  • PostSharp-AppDomain.config
  • PostSharp-Platform.config
  • PostSharp.Core.dll
  • PostSharp.Core.pdb*
  • PostSharp.Core.XmlSerializers.dll
  • PostSharp.exe
  • PostSharp.exe.config
  • PostSharp.pdb*
  • PostSharp.Laos.dll
  • PostSharp.Laos.pdb*
  • PostSharp.Laos.psplugin
  • PostSharp.Laos.Weaver.dll
  • PostSharp.Laos.Weaver.pdb*
  • PostSharp.MSBuild.dll
  • PostSharp.MSBuild.pdb*
  • PostSharp.Public.dll
  • PostSharp.Public.pdb*

* = Optional
Add a reference to the PostSharp.Laos and PostSharp.Public assemblies in your project.

Then you have to edit your .csproj file around the existing <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> section to be:
<PropertyGroup>
<DontImportPostSharp>True</DontImportPostSharp>
<PostSharpDirectory>lib\</PostSharpDirectory>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(PostSharpDirectory)PostSharp.targets" />