Visual Studio下运行PowerShell脚本自动更新项目里AssemblyInfo.cs文件的版本(自增小版本号)并发布到Nuget服务器上

附脚本【 update.ps1文件内容】:

$path="Properties\AssemblyInfo.cs"
$pattern = '\[assembly: AssemblyVersion\("(.*)"\)\]'
(Get-Content $path) | ForEach-Object{
if($_ -match $pattern){
# We have found the matching line
# Edit the version number and put back.
$fileVersion = [version]$matches[1]
$newVersion = "{0}.{1}.{2}.{3}" -f $fileVersion.Major, $fileVersion.Minor, $fileVersion.Build, ($fileVersion.Revision + 1)
'[assembly: AssemblyVersion("{0}")]' -f $newVersion
} else {
# Output line as is
$_
}
} | Set-Content $path  -Encoding utf8
$pattern = '\[assembly: AssemblyFileVersion\("(.*)"\)\]'
(Get-Content $path) | ForEach-Object{
if($_ -match $pattern){
# We have found the matching line
# Edit the version number and put back.
$fileVersion = [version]$matches[1]
$newVersion = "{0}.{1}.{2}.{3}" -f $fileVersion.Major, $fileVersion.Minor, $fileVersion.Build, ($fileVersion.Revision + 1)
'[assembly: AssemblyFileVersion("{0}")]' -f $newVersion
} else {
# Output line as is
$_
}
} | Set-Content $path  -Encoding utf8
nuget pack  -Build -OutputFileNamesWithoutVersion
nuget push -Source "http://****" -ApiKey {password} Demo.nupkg

Visual Studio下运行PowerShell脚本自增小版本号并发布到Nuget服务器上的更多相关文章

  1. Visual Studio下SQLite数据库开发环境设置

    由于我们介绍的内容都是基于微软的Visual Studio下开发的Win32平台,所以下边我们介绍Visual Studio下SQLite数据库开发环境设置.具体而言我们有两种方式可以在Visual ...

  2. Visual Studio下使用jQuery的10个技巧

    广泛流行的jQuery是一个开源的,跨浏览器和兼容CSS 3的JavaScript库,你可以用它简化你的JavaScript编码任务和操作(添加,编辑和删除)HTML内容中的DOM元素,本文介绍10个 ...

  3. mac终端下运行shell脚本

    最近公司要弄关于IOS下自动化打包的东西,研究了用命令行的形式来代替手工的方式来处理.即: 用xcodebuild 和xcrun  语法来进行脚本实现.    但由于语法的结构够了,另一个问题产生了, ...

  4. Cocos开发中Visual Studio下HttpClient开发环境设置

    Cocos2d-x 3.x将与网络通信相关的类集成到libNetwork类库工程中,这其中包括了HttpClient类.我们需要在Visual Studio解决方案中添加libNetwork类库工程. ...

  5. Cocos开发中Visual Studio下libcurl库开发环境设置

    我们介绍一下win32中Visual Studio下libcurl库开发环境设置.Cocos2d-x引擎其实已经带有为Win32下访问libcurl库,Cocos2d-x 3.x中libcurl库文件 ...

  6. Visual Studio下Qt编程中对中文的处理

    Visual Studio下Qt编程中对中文的处理 本文为原创文章,原文地址http://www.cnblogs.com/c4isr/p/qt_develop_in_vs.html Visual St ...

  7. Cocos发展Visual Studio下一个libcurl图书馆开发环境的搭建

    我们解释win32在Visual Studio下一个libcurl图书馆开发环境的搭建.Cocos2d-x发动机实际上与Win32在访问libcurl库.Cocos2d-x 3.x在libcurl库文 ...

  8. Cocos发育Visual Studio下一个HttpClient开发环境设置

    Cocos2d-x 3.x相关类集成到网络通信libNetwork图书馆project于.这其中包括:HttpClient分类. 我们需要在Visual Studio溶液中加入libNetwork图书 ...

  9. CMake在Visual Studio下保持目录结构

    CMake在Visual Studio下保持目录结构 原理 主要通过CMAKE自带函数source_group来设定. 需要把add_executable()函数进行封装,包裹一层source_gro ...

随机推荐

  1. Chap6:风险与监督[《区块链中文词典》维京&甲子]

  2. c++ Stl 随笔

    1. template <class InputIterator, class Distance> void advance (InputIterator& it, Distanc ...

  3. ms sql server读取xml文件存储过程-sp_xml_preparedocument

    最近要在存储过程中读取xml中节点的值,然后进行sql操作: 要使用到的系统存储过程如下:sp_xml_preparedocument create procedure [dbo].[pro_Test ...

  4. linux 源码安装 mono

    $ yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2- ...

  5. UOJ244 短路 贪心

    正解:贪心 解题报告: 传送门! 贪心真的都是些神仙题,,,以我的脑子可能是不存在自己想出解这种事情了QAQ 然后直接港这道题解法趴,,, 首先因为这个是对称的,所以显然的是可以画一条斜右上的对角线, ...

  6. 关于话题模型(topic model)的一些思考

    最近在分析知乎的‘问题’文本所属的话题,用python提取,实现了LSTM和LDA模型在这个方面的应用,但是效果不是很理想,一个是这些文本属于短文本,另外用来分析的文本本身包含多个领域的问题,并且数量 ...

  7. NOIP国王游戏

    #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #inc ...

  8. MVC编程模式

    MVC编程模式 MVC 是一种使用 MVC(Model View Controller 模型-视图-控制器)设计创建 Web 应用程序的模式: Model(模型)表示应用程序核心(比如数据库记录列表) ...

  9. Innodb semi-consistent 简介

    A type of read operation used for UPDATE statements, that is a combination of read committed and con ...

  10. centos下搭建sockets5代理

    #安装依赖及ss5 yum -y install gcc openldap-devel pam-devel openssl-devel wget https://nchc.dl.sourceforge ...