C# .csproj Baseoutputpath/Outputpath、AppendTargetFrameworkToOutputPath

参考:

Common MSBuild Project Properties - MSBuild | Microsoft Learn

目前看来,二者都指定输出地址。

前者会添加当前项目的配置属性:

后者:

  • 直接使用指定的路径作为输出目录

  • 不会添加额外的配置(Debug/Release)和框架(net461\.Net 2...)子目录

远程调试时想把exe直接输出到远程计算机上,可以这样设置:

XML 复制代码
<PropertyGroup>
  <OutputType>WinExe</OutputType>
  <TargetFramework>net461</TargetFramework>
  <UseWPF>true</UseWPF>
 <LangVersion>11.0</LangVersion>
  <SignAssembly>false</SignAssembly>
  <ApplicationManifest>app.manifest</ApplicationManifest>
  <Version>1.4.0</Version>
  <ApplicationIcon>Resource\Image\burger.ico</ApplicationIcon>
  <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
  <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 <!--<OutputPath Condition="'$(Configuration)'=='Debug'">\bin\Output\</OutputPath>
 <OutputPath Condition="'$(Configuration)'=='远程'">\\DESKTOP-V21FG2T\Share\FluentVision\bin\Output\远程\</OutputPath>-->
  <!--<OutputPath>bin\Output\</OutputPath>-->
  <OutputPath>\\DESKTOP-V21FG2T\Share\FluentVision\bin\Output\远程\net461</OutputPath>
  <!--<BaseOutputPath>\\DESKTOP-V21FG2T\Share\FluentVision\bin\Output</BaseOutputPath>-->
  <PackAsTool>False</PackAsTool>
  <PackageOutputPath>\\DESKTOP-V21FG2T\Share\FluentVision\bin\Output</PackageOutputPath>
  <PlatformTarget>x64</PlatformTarget>
  <Configurations>Debug;Release;远程</Configurations>
</PropertyGroup>

还没研究明白区别到底在哪里,可以多试试,Baseoutputpath/Outputpath都尝试设置一遍然后查看输出是否成功;

AppendTargetFrameworkToOutputPath:

为false时:

为true时:

多了一层框架名称文件夹。

未完

相关推荐
Xin_ye1008612 小时前
C# 零基础到精通教程 - 第七章:面向对象编程(入门)——类与对象
开发语言·c#
rockey62712 小时前
AScript异步执行与await关键字
c#·.net·script·eval·expression·异步执行·动态脚本
程序leo源13 小时前
Qt窗口详解
开发语言·数据库·c++·qt·青少年编程·c#
月巴月巴白勺合鸟月半18 小时前
质本洁来还洁去,强于污淖陷文本
c#
Xin_ye1008619 小时前
C# 零基础到精通教程 - 第八章:面向对象编程(进阶)——继承与多态
开发语言·c#
asdzx6720 小时前
使用 C# 打印 Excel 文档(详细教程)
c#·excel
伽蓝_游戏1 天前
第四章:AssetBundle 核心机制与文件结构
unity·c#·游戏引擎·游戏程序
2501_930707781 天前
使用C#代码拆分 PowerPoint 演示文稿
开发语言·c#·powerpoint
SenChien1 天前
C#学习笔记-入门篇
笔记·学习·c#·rider
诙_1 天前
由C++速通C#
开发语言·c#