Skip to end of metadata

 

Go to start of metadata

 

You can integrate SmartAssembly in your build process.

You set up your project in SmartAssembly once, and you can then build your assembly in your normal MSBuild process. The settings you chose in the SmartAssembly project are applied without needing to run SmartAssembly separately.

Note that the SmartAssembly task should be the last stage of your build process. Because of the way SmartAssembly changes your assembly, running other tasks after SmartAssembly is not supported. (An exception to this is assembly-signing tools, if you choose not to sign your code with SmartAssembly).

To integrate SmartAssembly directly into the build process, follow these steps:

  1. Create your project in SmartAssembly (see Working with projects) and set the project options (see Working with project settings).
  2. Open your application's .csproj or .vsprojfile in an XML editor.
    The .csproj or .vsproj file is actually a MSBuild XML file that you can edit to add SmartAssembly to the build tasks. For more information about the MSBuild XML schema, see the MSBuild documentation on MSDN.
  3. Add references to SmartAssembly to your C# or VB.NET project file, as follows. 

    Note that the <UsingTask> element includes SmartAssembly's major version number. This page has been written for SmartAssembly 6.x. If you are using a different version of SmartAssembly, you will need to change the version number specified in the <UsingTask> element. For example, if you use SmartAssembly 5.5, change the version to Version=5.0.0.0

     

    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        ...
      </PropertyGroup>
      ...
      <ItemGroup>
        ...
      </ItemGroup>
      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
      <UsingTask
     TaskName="SmartAssembly.MSBuild.Tasks.Build"
    AssemblyName="SmartAssembly.MSBuild.Tasks, Version=6.0.0.0,
    Culture=neutralPublicKeyToken=7f465a1c156d4d57" />
      <Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release' ">
        <SmartAssembly.MSBuild.Tasks.Build ProjectFile="c:\path\to\project.saproj"/>
      </Target>
    </Project>

     

  4. Edit the following line (near the bottom of the XML which you just added to the project), setting the ProjectFile attribute to the path to your *.saproj file:
    <SmartAssembly.MSBuild.Tasks.Build ProjectFile="c:\path\to\project.saproj"/>
  5. If required, add any of the following optional attributes to the same element:

    OverwriteAssembly

    Set to True if you want to overwrite the original assembly with the obfuscated one.

    If this option is not set, or set to False, SmartAssembly uses the destination file name from the .saproj project.

    If you set this option to True, SmartAssembly ignores the OverwriteAssembly attribute, if set.

    Input

    If this option is set, SmartAssembly will process the assembly specified as this attribute's value.

    If this option is not set, SmartAssembly will process the assembly specified in the .saproj project is used.

    This is useful if you want to build an assembly using exactly the same settings as those you chose for a different assembly.

    Output

    If this option is set, SmartAssembly will use this attribute's value as the file name when saving the built assembly.

    If this option is not set, SmartAssembly will use the file name in the .saproj file when saving the built assembly.

    This attribute is ignored if the OverwriteAssembly property is set to True.

    This option is useful if you want to save a test build to a different path from other builds.

    MarkAsReleased

    (Deprecated)

    This option was used in SmartAssembly 6.2 and earlier to preserve map files (see About map files).

    SmartAssembly 6.5 stores map files permanently, so this option is ignored.

    A diff showing the added lines in a .csproj file is shown below.

    Build your assembly with MSBuild. SmartAssembly is run automatically, using the settings in your SmartAssembly project file.

    If you use a .mdb file for your SmartAssembly database, ensure that Visual Studio is run as an administrator when running MSBuild.

Using SmartAssembly with MSBuild的更多相关文章

  1. Jenkins配置MSBuild实现自动部署(MSBuild+SVN/Subversion+FTP+BAT)

    所要用到的主要插件: [MSBuild Plugin] 具体操作: 1.配置MSBuild的版本 [系统管理]->[Global Tool Configuration]->[MSBuild ...

  2. 使用roslyn代替MSBuild完成解决方案编译

    原本我是使用批处理调用 MSBuild 完成解决方案编译的,新版的 MSBuild 在 Visual Studio 2015 会自带安装. 当然在Visual Studio 2015 中,MSBuil ...

  3. MSBuild 编译 C# Solution

    Microsoft(R) 生成引擎版本 4.6.1055.0 [Microsoft .NET Framework 版本 4.0.30319.42000] 版权所有 (C) Microsoft Corp ...

  4. UWP Jenkins + NuGet + MSBuild 手把手教你做自动UWP Build 和 App store包

    背景 项目上需要做UWP的自动安装包,在以前的公司接触的是TFS来做自动build. 公司要求用Jenkins来做,别笑话我,之前还真不晓得这个东西. 会的同学请看一下指出错误,不会的同学请先自行脑补 ...

  5. MSBuild的简单介绍与使用

    MSBuild 是 Microsoft 和 Visual Studio的生成系统.它不仅仅是一个构造工具,应该称之为拥有相当强大扩展能力的自动化平台.MSBuild平台的主要涉及到三部分:执行引擎.构 ...

  6. Jenkins学习九:Jenkins插件之构建MSBuild

    Jenkins是Java语言编写的,一直好奇是否可以构建NET语言的项目,目前只了解到有一个插件MSBuild支持构建NET项目. 一.Jenkins安装插件MSBuild 二.VS构建CsharpH ...

  7. CCNET+MSBuild+SVN实现每日构建

    最近开始将源代码迁移到SVN,于是便考虑到如何从SVN定期获取源码,自动编译并部署以减轻工作量并提高工作效率.通过多方搜集资料并进行研究,基本实现了这个功能.对于每日构建的概念就不具体展开了,可以在各 ...

  8. Msbuild项目集成右键菜单编译

    DS1.背景:   我们为什么要将VS2008命令行编译.sln文件集成到右键菜单呢? 原因一:VS2008很好很强大,但太费系统资源了,尤其是在虚拟机在里面装VS2008的时候更是如此. 原因二:有 ...

  9. 集成Visual Studio/MSBuild的开发/发布流程和 FIS3

    谁不想让自己的网站速度更快?为此需要多方面的优化,但优化又会增加开发工作量.Fis3 是很不错的前端优化工具,能够让前端的优化变得自动方便,解决前述问题.Fis3是百度开发的,开源的,在国内比较六流行 ...

随机推荐

  1. pthon中的基本运算

    格式化输出的三种方式 1.占位符 程序中经常会有这样的场景:要求用户输入信息,然后打印成固定的格式 比如要求用户输入用户名和年龄,然后打印如下格式: my name is xxx,my age is ...

  2. Python学习(五)—— 集合和字符格式化

    数据类型和变量的总结 字符串 数字 列表 元组 字典 分类 1.可变不可变: 可变(即修改变量值以后id不改变):列表.字典 不可变(即修改变量值以后id改变):字符串.数字.元组 2.访问顺序: 直 ...

  3. 巧用命令行工具 redis-cli

    我们天天都在使用 Redis 内置的命令行工具 redis-cli,久而久之以为它就是一个简单的交互式 Redis 数据结构手工操作程序,但是它背后强大的功能绝大多数同学可能闻所未闻.本节我们一起来挖 ...

  4. mcast_set_ttl函数

    #include <errno.h> #include <net/if.h> #include <sys/socket.h> #include <netine ...

  5. nginx+keepalived实现主从高可用

    设备: 主:192.168.200.122 从:192.168.200.124 安装:两台都分别安装nginx以及keepalived 两台机步骤一致一主一从 安装nginx的依赖包 [root@lo ...

  6. python学习Day25--正则表达式1

    [知识点] # 所有模块要经历的两个步骤: ① 要操作的概念本身:正则表达式   时间 ② 使用模块取操作它:re                  time 1.正则表达式:一种匹配字符串的规则 # ...

  7. centos610无桌面安装libreoffice

    Centos610系列配置 #安装文件 yum -y install libreoffice #安装中文包 yum -y install libreoffice-langpack-zh-Han* #安 ...

  8. python基础(一)--python介绍

    1. Python语言 1.1 编程语言 语言是人类最重要的交际工具,是人类之间进行信息交换的主要表达方式. 编程语言是用来定义计算机程序的语言,用来向计算机发出指令. 1.2 Python语言 Py ...

  9. Springboot学习:Thymeleaf 语法基础

    详细内容见:Thymeleaf Tutorial 中文翻译,中文文档 参考: thymeleaf官方指南 新一代Java模板引擎Thymeleaf Thymeleaf基本知识 thymeleaf总结文 ...

  10. 如何查看Ubuntu系统版本

    在Ubuntu终端,常用以下几种方式查看系统版本: 一.uname -a 二.cat /etc/issue 三.cat /etc/lsb-release 四.lsb_release -a 五.cat ...