利用Nuget打包添加tools下intsall.ps1【powershell脚本】修改.csproj文件,

以设置
1、项目-生成-》输出-》选择【XML文件文件】

2、项目->调试-》启用调试器:取消[启用Visual Studio承载进程]

install.ps1脚本如下:

param($installPath, $toolsPath, $package, $project)

# save project first
$project.Save()

$xml = [xml](Get-Content -path $project.FullName)

$default = $xml.Project.PropertyGroup | Where-Object { $_.Condition -eq $null }

$assemblyName=$default.AssemblyName

if($default.DocumentationFile -eq $null) {
    $path = "bin\Debug\$($default.AssemblyName).xml"
    $node = $xml.CreateElement('DocumentationFile', $xml.DocumentElement.NamespaceURI)
    $node.InnerText = $path
    $default.AppendChild($node) | Out-Null
}

if($default.UseVSHostingProcess -eq $null) {    
    $node1 = $xml.CreateElement('UseVSHostingProcess', $xml.DocumentElement.NamespaceURI)
    $node1.InnerText = "false"
    $default.AppendChild($node1) | Out-Null
}

#Debug

$default = $xml.Project.PropertyGroup | Where-Object { $_.Condition -Like '*Debug|AnyCPU*' }
if($default.DocumentationFile -eq $null) {
    $path = "bin\Debug\$($assemblyName).xml"
    $node = $xml.CreateElement('DocumentationFile', $xml.DocumentElement.NamespaceURI)
    $node.InnerText = $path
    $default.AppendChild($node) | Out-Null
}

if($default.UseVSHostingProcess -eq $null) {    
    $node1 = $xml.CreateElement('UseVSHostingProcess', $xml.DocumentElement.NamespaceURI)
    $node1.InnerText = "false"
    $default.AppendChild($node1) | Out-Null
}

#Release

$default = $xml.Project.PropertyGroup | Where-Object { $_.Condition -Like '*Release|AnyCPU*' }
if($default.DocumentationFile -eq $null) {
    $path = "bin\Release\$($assemblyName).xml"
    $node = $xml.CreateElement('DocumentationFile', $xml.DocumentElement.NamespaceURI)
    $node.InnerText = $path
    $default.AppendChild($node) | Out-Null
}

if($default.UseVSHostingProcess -eq $null) {    
    $node1 = $xml.CreateElement('UseVSHostingProcess', $xml.DocumentElement.NamespaceURI)
    $node1.InnerText = "false"
    $default.AppendChild($node1) | Out-Null
}

$project.Save()

$xml.save($project.FullName)

利用Nuget打包添加tools下intsall.ps1【powershell脚本】修改.csproj文件的更多相关文章

  1. [2016-07-15]nuget包管理器控制台下的powershell脚本介绍

    博客有阵子没打理了,今天刚恢复样式,但是标题还是不太正常,总算能凑合看看. 回到正题,最近为了能在VS的程序包管理器控制台上能方便的自定义ps脚本去调整project的package,就开始看powe ...

  2. nuget包管理器控制台下的powershell脚本介绍

    http://personball.com/powershell/2016/07/15/powershell-tips 定制自己的powershell,减少重复工作 安装一系列自己的常用nuget包 ...

  3. Mac下通过shell脚本修改properties文件

    通过shell脚本替换属性文件中的某行记录 假设有如下属性文件 demo.properties user.name=test user.password=123456 ................ ...

  4. 【ASP.NET】利用Nuget打包package——命令行方式

    通过命令行 官方说明,可以参考:creating-and-publishing-a-package 如果你希望可以使用图形界面的方式,请参考这篇文章   打包dll   使用如下的命令: nuget  ...

  5. 【ASP.NET】利用Nuget打包package——GUI方式

    GUI方式 通过GUI的方式,可以下载如下的软件 NuGetPackageExplorer   打包dll 1.打开软件,在Package Content处点击右键 ,选择Add Lib 2.在lib ...

  6. Nuget~打包时添加powershell初始化脚本

    对于进行nuget打包时,有时我们需要添加一个配置文件,就是一些文本文件,而这些文件我们在网站发布时需要同时复制到输出目录,否则会出现文件丢失的问题,我们在打包时通过添加powershell脚本来解决 ...

  7. cocos2dx 3.x(在Mac平台下利用Eclipse打包安卓apk安装包详细教程)

    最近在学习cocos2dx在MAC上如何打包apk,今天先把安装JDK和ANT的过程记来. 首先,打开终端,输入"java -version" 点击回车后,出现如下提示: 我们的M ...

  8. 使用NuGet打包并发布至ProGet过程 (打包再次详解)【下篇】

    一.前言 上篇[1]主要介绍了利用csproj文件使用NuGet打包至ProGet的过程,并附上了用于在Jenkins上运行的python脚本.本篇的主要内容分为以下几点: 1. Nuspec与Nup ...

  9. 【NuGet】使用NuGet打包并发布至ProGet过程 (打包再次详解)【下篇】

    一.前言 上篇[1]主要介绍了利用csproj文件使用NuGet打包至ProGet的过程,并附上了用于在Jenkins上运行的python脚本.本篇的主要内容分为以下几点: 1. Nuspec与Nup ...

随机推荐

  1. c# 字符串转为数字

    C#判断输入是否数字 /// <summary> /// 判断输入是否数字 /// </summary> /// <param name="num"& ...

  2. hide server info

    <?php /*wamp64\bin\apache\apache2.4.18\confhttpd.conf ServerSignature On  ServerTokens Full Serve ...

  3. appium入门(1)__ appium介绍

    摘自:http://www.testclass.net/appium/appium-base-summary/ 1.特点 appium 是一个自动化测试开源工具,支持 iOS 平台和 Android ...

  4. kibana设置mapping

    demo: PUT linewell_assets_mgt_fz_es/lw_devices/_mapping { "properties": { "update_tim ...

  5. pacakge-info.java

    翻看以前的笔记,看到一个特殊的java文件:pacakge-info.java,虽然有记录,但是不全,就尝试着追踪一下该问题, 分享一下流水账式的结果. 首先,它不能随便被创建.在Eclipse中, ...

  6. CF720A Closing ceremony 贪心

    正解:贪心 解题报告: 传送门! 先考虑如果只有一列怎么搞?那就肯定是尽量走到最远的地方 然后用点儿类似的思想,现在考虑有两列的情况QAQ 为了方便表述,这里给每个位置两个值,a表示离一号入口的距离, ...

  7. TZOJ 3198: 区间和

    描述 给定n个数据,有两个操作,加减其中的一个数据,当然还可查询在某段数据的和. 输入 输入数据有多组,每组数据的第一行输入n,1=<n<=500000,代表数据的个数.第二行输入具体数据 ...

  8. 解读EXPLAIN执行计划中的key_len(转)

    原文:http://imysql.com/2015/10/20/mysql-faq-key-len-in-explain.shtml 导读 EXPLAIN中的key_len一列表示什么意思,该如何解读 ...

  9. 对集合类的属性进行kvo观察

    在进行容器对象操作时,先调用下面方法通过key或者keyPath获取集合对象,然后再对容器对象进行add或remove等操作时,就会触发KVO的消息通知了. - (NSMutableArray *)m ...

  10. (4.26)sql server存储过程优化

    此博客介绍了简单但有用的提示和优化,以提高存储过程的性能. 0.with recompile:重编译 exec uspGetSalesInfoForDateRange ‘1/1/2009’, 31/1 ...