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
>
<
Import
Project
=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<
UsingTask
TaskName
=
"SmartAssembly.MSBuild.Tasks.Build"
AssemblyName="SmartAssembly.MSBuild.Tasks,
Version
=
6
.0.0.0,
Culture
=
neutral
,
PublicKeyToken
=
7f465a1c156d4d57
" />
<
Target
Name
=
"AfterBuild"
Condition
=
" '$(Configuration)' == 'Release' "
>
<
SmartAssembly.MSBuild.Tasks.Build
ProjectFile
=
"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
ProjectFile
attribute 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是百度开发的,开源的,在国内比较六流行 ...
随机推荐
- C语言与汇编的嵌入式编程:main中模拟函数的调用(两数交换)
编写一个两数交换函数swap,具体代码如下: #include<stdio.h> void swap(int *p1,int *p2) { int temp; temp = *p1; *p ...
- ST股
一.简介: 意即“特别处理”.该政策针对的对象是出现财务状况或其他状况异常的. 1998年4月22日,沪深交易所宣布,将对财务状况或其它状况出现异常的上市公司股票交易进行特别处理(Special tr ...
- ZooKeeper下载安装配置-单机版配置
1,下载地址:http://apache.fayea.com/zookeeper/ 2,检查环境变量(需要确保配置了环境变量): java -version 3,安装配置: (1)解压 tar -zx ...
- Go之第三方日志库logrus使用
文章引用自 第三方日志库logrus使用 日志是程序中必不可少的一个环节,由于Go语言内置的日志库功能比较简洁,我们在实际开发中通常会选择使用第三方的日志库来进行开发.本文介绍了logrus这个日志库 ...
- Android学习07
自定义Dialog 创建一个Java类CustomDialog继承Dialog. package com.example.helloworld.widget; import android.app.D ...
- BugReport-智慧农业APP
1.展示的界面显示不全 bug Description: 测试环境:win10.工具eclipse: 测试步骤:打开运行程序后模拟器启动,第一个界面显示过几秒跳到了另一个界面,问题是第一个界面显示不全 ...
- Springboot中使用kafka
注:kafka消息队列默认采用配置消息主题进行消费,一个topic中的消息只能被同一个组(groupId)的消费者中的一个消费者消费. 1.在pom.xml依赖下新添加一下kafka依赖ar包 < ...
- 解决前端项目启动时报错:Use // eslint-disable-next-line to ignore the next line.
首先说一下这个问题产生的原因: 项目创建时设置了使用 eslint 进行代码规范检查. 解决办法: 找到webpack.base.conf.js文件,并且将下满这行代码注释掉. ...(config. ...
- 吴裕雄--天生自然SSH框架开发:搭建一个完整的SSH框架
下载jar包 spring框架的jar包:https://repo.spring.io/ hibernate框架的jar包:http://hibernate.org/orm/ struts2框架的ja ...
- Cisco AP-Flexconnect配置结果
一个部署Flexconnect AP(印度)注册到远端WLC(上海)的例子:1.连接AP的交换机接口的配置: nterface GigabitEthernet0/4switchport access ...