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时:

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

未完

相关推荐
周杰伦fans18 小时前
C# required 关键字详解
开发语言·网络·c#
游乐码20 小时前
c#ArrayList
开发语言·c#
唐青枫20 小时前
C#.NET Monitor 与 Mutex 深入解析:进程内同步、跨进程互斥与使用边界
c#·.net
周杰伦fans21 小时前
cad文件选项卡不见了怎么办?
c#
llm大模型算法工程师weng1 天前
Python敏感词检测方案详解
开发语言·python·c#
游乐码1 天前
c#stack
开发语言·c#
橘子编程1 天前
编程语言全指南:从C到Rust
java·c语言·开发语言·c++·python·rust·c#
zztfj1 天前
C# 异步方法 async / await CancellationToken 设置任务超时并手动取消耗时处理
c#·异步
无风听海1 天前
.NET10之C# 中的is null深入理解
服务器·c#·.net
龙侠九重天1 天前
C# 机器学习数据处理
开发语言·人工智能·机器学习·ai·c#