LoginSignup
3
1

More than 1 year has passed since last update.

[.NET5] 出力フォルダの中に「net5.0-windows」フォルダができないようにする

Last updated at Posted at 2021-12-13

もくじ

やりたいこと

ビルドしたときにコンフィグ名(Debug/Release等)のフォルダの下に「net5.0-windows」というフォルダができる。(.netFrameworkのときにはなかった)
image.png

これを、.netFrameworkと同じように、「Debug」フォルダのすぐ下に出るようにしたい。

やり方

下記の2行を、csprojフォルダに設定を追記する。

    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>

全体としては、下記のようになる。

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0-windows</TargetFramework>
    <UseWPF>true</UseWPF>
	<EnableDefaultApplicationDefinition>false</EnableDefaultApplicationDefinition>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>★これ★
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>★これ★
    <Platforms>AnyCPU;x64</Platforms>
  </PropertyGroup>

  <ItemGroup>
    <ApplicationDefinition Remove="App.xaml" />
  </ItemGroup>

</Project>

下記のように「net5.0-windows」フォルダがなくなって、一段上がる感じになる。

image.png

参考

MS公式

上記ページのコレ
image.png

MS公式
csprojに設定できる内容一覧

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1