クリエイターの教科書

ChatGPT, Stable Diffusion, Visual Studio, Excelなど教科書

【Visual Studioの教科書】プロジェクトで作られるファイル種類 resx?config?

プロジェクトを作るといろんなファイルが作られます。

割合XMLベースのものもあるので、ファイルのほうを直接変更したほうが早い場合もあるでしょう。

ここではどんなファイルがあるか紹介します。

プロジェクトで作られるファイルの種類は?

CONvergence 2008

C#のウィンドウズフォームアプリケーションの場合、以下のようなファイルが作られていました。

 

場合によってはこちらを編集したほうが早いかもしれません。

また、VisualStudioのバグ?でなぜか変更が反映されない場合は、こちらのファイルの情報を確認する必要があるかもしれません。

 

一応どんなファイルがどんな感じで書かれているかだけでも知っておくとよいでしょう。

 

App config

起動時のドットネットフレームワークのバージョンなどが指定されています。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

 

packages.config

NuGetしたライブラリ情報が記録されています。

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="OpenCvSharp4" version="4.2.0.20200108" targetFramework="net472" />
<package id="OpenCvSharp4.runtime.win" version="4.2.0.20200108" targetFramework="net472" />
</packages>

 

CSPROJファイル

XMLファイル形式で、プロジェクトの詳細が記録されています。

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\OpenCvSharp4.runtime.win.4.2.0.20200108\build\net\OpenCvSharp4.runtime.win.props" Condition="Exists('..\packages\OpenCvSharp4.runtime.win.4.2.0.20200108\build\net\OpenCvSharp4.runtime.win.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5472C026-0FB2-44DD-94C2-100E3C563C73}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>kKoma1</RootNamespace>
<AssemblyName>kKoma1</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>t

....

 

 

CSPROJ.USERファイル

プロジェクトの発行(パブリッシュ)情報など。USERとあるので、複数人で開発しているときの個別ユーザデータとかかもしれません。

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>C:\Users\akyip\source\repos\kKoma2\publish\|publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>ja-JP</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
<PropertyGroup>
<EnableSecurityDebugging>false</EnableSecurityDebugging>
</PropertyGroup>
</Project>

 

 

CSファイル

C#の場合のソースコードです。

using System.Data;
using System.Drawing;
....

 

namespace kKoma1
{
public partial class Form1 : Form
{

....

 

Designer.csファイル

Form1.Designer.csなど、フォームのデザイン情報が書かれたファイルです。

こちらは整合性のためエディタでの修正をしないように書かれています。

namespace kKoma1
{
partial class Form1
{
/// <summary>
/// 必要なデザイナー変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージド リソースを破棄する場合は true を指定し、その他の場合は false を指定します。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows フォーム デザイナーで生成されたコード

/// <summary>
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
/// コード エディターで変更しないでください。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.lInfo = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();

....

 

resxファイル

「Form1.resx」のようにフォームごとに利用しているツールのプロパティが記録されています。

....

<data name="goToTopToolStripMenuItem.ShortcutKeys" type="System.Windows.Forms.Keys, System.Windows.Forms">
<value>Ctrl+1</value>
</data>
<data name="goToTopToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>254, 32</value>
</data>

....

 

 

 ja.rexファイル

「Form1.ja.resx」のようにフォームごとに生成されるファイル。

ちゃんと確認したわけではないですが「ja」とあることから、ローカライズ言語で日本語用データを保存しているのではないかと思います。

....

<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="va

....

 

_TemporaryKey.pfx

バイナリなので中身は確認できません。

このブログは、ネットや書籍上の情報、個人の体験や感想を中心にまとめたものです。 正確性を期していはいますが、間違い・誤訳等あるかもしれません。 当サイトの情報によって生じたいかなる損失について一切の責任を負わないものとします. あらかじめご了承ください。

プライバシーポリシー |〇利用規約 |〇問い合わせ