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

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

未完

相关推荐
JQLvopkk2 小时前
能用C#开发AI
开发语言·人工智能·c#
游乐码9 小时前
c#类和对象
开发语言·c#
沃码13 小时前
【Lively Wallpaper 】插件开发:LivelyProperties.json 全流程实战教程
c#·json·livelywallpaper·视频壁纸
github.com/starRTC18 小时前
Claude Code中英文系列教程34:再谈Skills
开发语言·c#·ai编程
bugcome_com20 小时前
C# 判断语句详解(if、switch、三目运算符、Null 条件运算符)
c#
霸王•吕布1 天前
C#-使用OpenTK渲染3D模型
c#·opentk·glcontrol
游乐码1 天前
c#封装成员变量和成员方法和访问修饰符
开发语言·c#
Never_Satisfied1 天前
在c#中,Jint的AsString()和ToString()的区别
服务器·开发语言·c#
Never_Satisfied1 天前
在c#中,获取文件的大小
java·开发语言·c#
weixin_468466851 天前
PyTorch导出ONNX格式分割模型及在C#中调用预测
人工智能·pytorch·深度学习·c#·跨平台·onnx·语义分割