<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>hanaaaaaachiru</author_name>
  <author_url>https://blog.hatena.ne.jp/hanaaaaaachiru/</author_url>
  <blog_title>はなちるのマイノート</blog_title>
  <blog_url>https://www.hanachiru-blog.com/</blog_url>
  <categories>
    <anon>C#</anon>
  </categories>
  <description>はじめに 今回はMSBuildで環境変数によってDefineConstantsを用いてコードを切り替える方法を紹介したいと思います。 はじめに 概要 やり方 実験 概要 環境変数によってC#コードを変更したいこともあるかなと思います。 // 環境変数「HOGE_VERSION」が「1.0.0」以上の場合に「HOGE_1_0_0_OR_NEWER」を定義したい #if HOGE_1_0_0_OR_NEWER Console.WriteLine(&quot;v1.0.0以上のバージョンです。&quot;); #else Console.WriteLine(&quot;v1.0.0未満のバージョンです。&quot;); #endif MS…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.hanachiru-blog.com%2Fentry%2F2024%2F12%2F12%2F120000&quot; title=&quot;【C#】MSBuildで環境変数によってDefineConstantsを用いてコードを切り替える方法 - はなちるのマイノート&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-12-12 12:00:00</published>
  <title>【C#】MSBuildで環境変数によってDefineConstantsを用いてコードを切り替える方法</title>
  <type>rich</type>
  <url>https://www.hanachiru-blog.com/entry/2024/12/12/120000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
