使用多目标时,从C#中输出文件名中的目标框架

时间:2017-04-23 09:51:15

标签: c# msbuild visual-studio-2017 csproj

编译C#应用程序时,输出的文件名为 ProjectName.dll 。 但是,如果我希望文件名为 ProjectName.net46.dll

,该怎么办?

修改

如果我使用<TargetFrameworks>net46;net40</TargetFrameworks>

,我希望输出为 ProjectName.net46.dll ProjectName.net40.dll

1 个答案:

答案 0 :(得分:1)

经过一些调查,我找到了this line。基于此,解决方案变得如此简单:

<?xml version="1.0" encoding="UTF-8"?>
		<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
		<!-- Creator: CorelDRAW X7 -->
		<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="300px" height="500px" version="1.0" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
		viewBox="-950 0 2111 828"
		 xmlns:xlink="http://www.w3.org/1999/xlink">
		 <defs>
		  <style type="text/css">
		   <![CDATA[
		    .fil2 {fill:#848688}
		    .fil4 {fill:#F8A25F}
		    .fil1 {fill:#848688;fill-rule:nonzero}
		    .fil3 {fill:#F8A25F;fill-rule:nonzero;}
		    .fil0 {fill:#A0CD47;fill-rule:nonzero}
		   ]]>
		  </style>
		 </defs>
		 <g id="Layer_x0020_1">
		  <metadata id="CorelCorpID_0Corel-Layer"/>
		  <path class="fil0" d="M347 478l0 154 0 146c0,38 24,45 37,45 12,0 37,-7 37,-45l0 -149 0 -148 0 -149c0,-38 -25,-45 -37,-45 -13,0 -37,7 -37,45l0 146z"/>
		  <path class="fil1" d="M479 266l-109 110 -103 103c-27,27 -14,49 -5,58 9,9 31,22 58,-5l105 -106 105 -105 236 -237c27,-27 14,-49 5,-58 -8,-9 -31,-22 -58,5l-234 235z"/>
		  <circle class="fil2" cx="384" cy="414" r="82"/>
		  <g>
		  <path class="fil3" d="M119 155l105 114 242 262c25,28 39,25 44,20 4,-4 9,-17 -17,-45l-244 -265 -100 -109 -101 -109c-26,-28 -40,-24 -44,-20 -5,4 -10,17 16,45l99 107z"/>
		  </g>
		  <circle class="fil4" cx="384" cy="414" r="37"/>
		 </g>
		</svg>

使用此解决方案,* .exe,*。dll和* .pdb文件都在确定新名称。此解决方案还可以进行调试和单元测试。