zoukankan      html  css  js  c++  java
  • vs2010使用PostSharp 1.5

    转帖: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" />

  • 相关阅读:
    Node Sass version 5.0.0 is incompatible with^4.0.0
    解决vue-cli引入sass,报错:this.getResolve is not a function问题
    解决nuxt官方脚手架的一些坑:1、支持es6+语法 2、样式支持sass
    针对【create-nuxt-app新版本v3.2.0】构建项目时没有server配置以及运行后弹出收集匿名数据选项等问题的解决方法
    create-nuxt-app创建出来的目录没有server文件夹
    Redis安装(Windows环境下Redis安装)
    koa2中间件,路由,cookies
    用同步的写法来执行异步操作, async, awiat
    koa2 安装与启动
    练习:自己写一个容器ArrayList集合 一一数组综合练习
  • 原文地址:https://www.cnblogs.com/LifelongLearning/p/2232019.html
Copyright © 2011-2022 走看看