Using SmartAssembly with MSBuild
- Last edited May 20, 2013
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:
- Create your project in SmartAssembly (see Working with projects) and set the project options (see Working with project settings).
- 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.
- 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<PropertyGroup>...</PropertyGroup>...<ItemGroup>...</ItemGroup><ImportProject="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/><UsingTaskTaskName="SmartAssembly.MSBuild.Tasks.Build"AssemblyName="SmartAssembly.MSBuild.Tasks,Version=6.0.0.0,Culture=neutral,PublicKeyToken=7f465a1c156d4d57" /><TargetName="AfterBuild"Condition=" '$(Configuration)' == 'Release' "><SmartAssembly.MSBuild.Tasks.BuildProjectFile="c:\path\to\project.saproj"/></Target></Project>
- Edit the following line (near the bottom of the XML which you just added to the project), setting the ProjectFileattribute to the path to your *.saproj file:<SmartAssembly.MSBuild.Tasks.Build ProjectFile="c:\path\to\project.saproj"/>
- 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的更多相关文章
- Jenkins配置MSBuild实现自动部署(MSBuild+SVN/Subversion+FTP+BAT)
		所要用到的主要插件: [MSBuild Plugin] 具体操作: 1.配置MSBuild的版本 [系统管理]->[Global Tool Configuration]->[MSBuild ... 
- 使用roslyn代替MSBuild完成解决方案编译
		原本我是使用批处理调用 MSBuild 完成解决方案编译的,新版的 MSBuild 在 Visual Studio 2015 会自带安装. 当然在Visual Studio 2015 中,MSBuil ... 
- MSBuild 编译 C# Solution
		Microsoft(R) 生成引擎版本 4.6.1055.0 [Microsoft .NET Framework 版本 4.0.30319.42000] 版权所有 (C) Microsoft Corp ... 
- UWP Jenkins + NuGet + MSBuild 手把手教你做自动UWP Build 和 App store包
		背景 项目上需要做UWP的自动安装包,在以前的公司接触的是TFS来做自动build. 公司要求用Jenkins来做,别笑话我,之前还真不晓得这个东西. 会的同学请看一下指出错误,不会的同学请先自行脑补 ... 
- MSBuild的简单介绍与使用
		MSBuild 是 Microsoft 和 Visual Studio的生成系统.它不仅仅是一个构造工具,应该称之为拥有相当强大扩展能力的自动化平台.MSBuild平台的主要涉及到三部分:执行引擎.构 ... 
- Jenkins学习九:Jenkins插件之构建MSBuild
		Jenkins是Java语言编写的,一直好奇是否可以构建NET语言的项目,目前只了解到有一个插件MSBuild支持构建NET项目. 一.Jenkins安装插件MSBuild 二.VS构建CsharpH ... 
- CCNET+MSBuild+SVN实现每日构建
		最近开始将源代码迁移到SVN,于是便考虑到如何从SVN定期获取源码,自动编译并部署以减轻工作量并提高工作效率.通过多方搜集资料并进行研究,基本实现了这个功能.对于每日构建的概念就不具体展开了,可以在各 ... 
- Msbuild项目集成右键菜单编译
		DS1.背景: 我们为什么要将VS2008命令行编译.sln文件集成到右键菜单呢? 原因一:VS2008很好很强大,但太费系统资源了,尤其是在虚拟机在里面装VS2008的时候更是如此. 原因二:有 ... 
- 集成Visual Studio/MSBuild的开发/发布流程和 FIS3
		谁不想让自己的网站速度更快?为此需要多方面的优化,但优化又会增加开发工作量.Fis3 是很不错的前端优化工具,能够让前端的优化变得自动方便,解决前述问题.Fis3是百度开发的,开源的,在国内比较六流行 ... 
随机推荐
- centos7一步一步搭建docker tomcat 及重点讲解
			系统环境:centos7.7 (VMware中) image版本:tomcat:8-jdk8-openjdk (截止2020.01.10该系列版本) 安装步骤参考文章:https://www.jian ... 
- 计算机二级-C语言-程序修改题-190123记录-对整数进行取余和除以操作。
			//函数fun功能:将长整型数中每一位上为偶数的数依次取出,构成一个新数放在t中.高位仍在高位,低位仍在低位. //重难点:思路:因为不是字符串,所以可以把问题变成整数的操作,采用取余和除的操作.对整 ... 
- idea 创建maven子父工程
			1.创建maven工程: 2. 创建工程名称: 3.删除父工程下的src文件夹,指定打包方式为pom,添加maven依赖: 4.右键项目添加子工程: 5.添加子工程名称: 6.子工程创建成功: 7.依 ... 
- 15. 深入解析Pod对象(二):使用进阶
			15. 深入解析Pod对象(二):使用进阶 15.1 Projected Volume,投射数据卷 备注:Projected Volume 是 Kubernetes v1.11 之后的新特性 在 Ku ... 
- map或者对象转换
			map或者对象转换为具有相同字段的对象 List<Example> errorCodeExcelBeanList = JSONObject.parseArray(((JSONObject) ... 
- 02-12Android学习进度报告十二
			今天学习了ListView的焦点问题,基本了解了ListView的使用内容. 首先可以为抢占了控件的组件设置:android:focusable="false" 只需为抢占了Lis ... 
- Laravel 6.X 数据库迁移 创建表 与 修改表
			数据库迁移创建表 本篇文章中使用的是mysql数据库,其他数据库需要修改env文件和app配置,请其他地方搜索一下就会找到. 创建示例 1.创建users表: 命令行键入 php artisan ma ... 
- spring使用context:property-placeholder载不进属性问题
			环境:spring3.1.1+mybatis3.2.8+mybatis-spring1.2.3 今天整合了SpringMVC + MyBatis,发现了一个问题,在这里做个记录,各位如果遇到相同的问题 ... 
- Fedora26安装Mysql实记(包含yum换源教程)
			课程实验中有一项是安装Hive,这个过程中需要安装Mysql. 在安装Mysql耗费了好多时间,总是报错数据仓库同步失败什么的. 输入yum install mysql 就提示错误,连接不上数据源.该 ... 
- CSS的响应式布局
			响应式布局是什么 它是相对于固定像素大小的网页而言的,顾名思义,响应式布局就是网页能够响应各种各样不同分辨率大小的设备,能够将网页很好的呈献给用户. 如何实现响应式布局? 1.CSS3@media查询 ... 
