Visual Studio2017で.NETアプリケーションを開発しています。プロジェクトのビルド中に下記のエラーが発生しました。
エラー 2 つの出力ファイル名が同じ出力パスに解決されました:"obj\x86\Debug\Demo.Form1.resources"
ためしたことは以下の2つです。
1.
ディレクトリ内のForm1.resxを削除する
エラーに変化なし
.csprojの編集
エラーに関係していると思われるForm1に関連する部分を順にコメントアウト
最終的にすべてのForm1に関連する部分をコメントアウトしましたがエラーは変わらずでした。
<ItemGroup> <!-- <Compile Include="Backup\Form1.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Backup\Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile>--> <Compile Include="Backup\Program.cs" /> <Compile Include="Backup\Properties\AssemblyInfo.cs" /> <Compile Include="Backup\Properties\Resources.Designer.cs" /> <Compile Include="Backup\Properties\Settings.Designer.cs" /> <!-- <Compile Include="Form1.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpon> </Compile>--> <Compile Include="Form16_4_18.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Form16_4_18.Designer.cs"> <DependentUpon>Form16_4_18.cs</DependentUpon> </Compile> <Compile Include="Form16_4_27.cs"> <SubType>Form</SubType> </Compile> <Compile Include="Form16_4_27.Designer.cs"> <DependentUpon>Form16_4_27.cs</DependentUpon> </Compile> <Compile Include="Program.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\Resources.Designer.cs" /> <Compile Include="Properties\Settings.Designer.cs" /> </ItemGroup> <ItemGroup> <!-- <EmbeddedResource Include="Backup\Form1.resx"> <DependentUpon>Form1.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Backup\Properties\Resources.resx" /> <EmbeddedResource Include="Form1.resx"> <DependentUpon>Form1.cs</DependentUpon> </EmbeddedResource>--> <EmbeddedResource Include="Form16_4_18.resx"> <DependentUpon>Form16_4_18.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Form16_4_27.resx"> <DependentUpon>Form16_4_27.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx" /> </ItemGroup>
ファイルからもForm1.resxを消し、.csprojからもForm1を消したのにまだForm1に関連するエラーが発生しているというのが非常に不可解です。
C#に触れてまだ日が浅いため基本的な間違いをしている可能性,ここに挙げた情報が不足している可能性がございますがご回答いただければ幸いです。なにかほかに必要な情報などありましたらコメントよろしくお願いいたします。
回答ではないのでコメントのみですが:
<Compile Include="Backup\Properties\Resources.Designer.cs" />
と言うバックアップ用途(?)で自分で用意したディレクトリ下のファイルをプロジェクトに加えてしまっているとか、Form16_4_18やForm16_4_27など、フォームを複数追加しているのでしょうか。不適切な追加の仕方をしてしまっているのかもしれません。*.csprojファイルのそれっぽいところを分からないまま手動で修正しても、整合性が取れていないかもしれないので、気を取り直し、プロジェクトを新規で作り直した方が良いように思います。
(※ もちろん、有効な回答をいただけるかもしれませんが)
csprojファイルの編集を、このプロジェクトを読み込んでない状態で行いましたか?
- プロジェクトを新規で作りなおすのも試してみます
- アンロードしてから編集,その後再読み込みをしました
エラーが発生してからよりも、そもそもそのエラーが発生するまでに何をしたのか書かないと何が問題なのかのあたりもつけにくいです
> C#に触れてまだ日が浅いため
おそらくは本来の手順と異なるやり方で何かしらやったのが原因だとは思いますが、何をやったのかが不明なので見当がつきません
なお、プロジェクトファイルを直で編集するのは色々分かってからじゃないと失敗してビルドエラーやそもそもプロジェクトを開けなくなるといったトラブルが発生して、そこからさらに色々いじって取り返しがつかなくなる未来が待っているだけかと思われます

回答1件
あなたの回答
tips
プレビュー






