developer tip

두 개의 출력 파일 이름이 동일한 출력으로 확인 됨

copycodes 2020. 12. 4. 19:15
반응형

두 개의 출력 파일 이름이 동일한 출력으로 확인 됨


.NET 3.5 Framework 용 .NET 응용 프로그램을 개발 중입니다. 최근에 WorkersScreen이라는 새 Form을 만들었습니다. 프로젝트를 실행하려고 할 때이 오류가 발생했습니다.

Error   1   Two output file names resolved to the same output path: "obj\x86\Debug\DryWash.WorkersScreen.resources" DryWash

무슨 뜻이에요?


이는 동일한 양식을 가리키는 두 개의 .resx 파일의 경우에 발생할 수 있습니다. 대부분 양식의 이름을 바꿀 때 발생합니다 (다른 이유가 적용될 수 있지만 정확히 모르겠습니다)

특정 양식 파일이 다음과 같은 경우 :

Form1.cs
Form1.designer.cs
MyFormerFormName.resx
Form1.resx

그런 다음 일반적으로 양식의 이름을 변경했지만 Visual Studio가 이전 .resx 파일을 제거하지 않았 음을 의미합니다. 파일 (이 예에서는 MyFormerFormName.resx)을 수동으로 삭제하면 다음 빌드시 오류가 사라집니다.


8/03/16부터 이것은 나를 위해 작동 합니다!

먼저 프로젝트를 마우스 오른쪽 버튼으로 클릭하여 프로젝트를 언로드 한 다음 프로젝트 언로드 를 클릭 합니다.

여기에 이미지 설명 입력

프로젝트를 다시 마우스 오른쪽 버튼으로 클릭하고 프로젝트 편집을 클릭합니다 .

여기에 이미지 설명 입력

그것은 당신에게 몇 가지 코드를 보여줄 것이고, 제 경우에는 다음과 같은 중복 값을 찾으십시오.

<EmbeddedResource Include="frmTerminalSerial.resx">
      <DependentUpon>frmTerminalSerial.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmVisual.resx">
      <DependentUpon>frmVisual.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmVisual.resx">
      <DependentUpon>frmVisual.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
</EmbeddedResource>

이 부분은 중복됩니다 !

<EmbeddedResource Include="frmVisual.resx">
      <DependentUpon>frmVisual.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmVisual.resx">
      <DependentUpon>frmVisual.vb</DependentUpon>
</EmbeddedResource>

다음 과 같이 보이도록 그중 하나를 삭제 하십시오.

<EmbeddedResource Include="frmTerminalSerial.resx">
      <DependentUpon>frmTerminalSerial.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmVisual.resx">
      <DependentUpon>frmVisual.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
</EmbeddedResource>

저장하고 프로젝트를 마우스 오른쪽 버튼으로 클릭 한 다음 프로젝트 다시로드 를 클릭 합니다. 완료되었습니다!


일반적으로 다음과 같은 마이그레이션을 생성하면

Add-Migration "UpdateProducts"

Visual Studio는 UpdateProducts와 같은 클래스 이름을 사용하여 마이그레이션을 만듭니다. 나중에 동일한 마이그레이션 이름을 사용하여 새 마이그레이션을 추가하면 UpdateProducts1.과 같은 클래스 이름으로 마이그레이션이 생성되어 끝에 자동으로 증가 된 숫자가 접미사로 추가됩니다. 새 마이그레이션을 생성 할 때마다 숫자가 하나씩 증가합니다.

In our case, for some reason, VS got confused, and started generating subsequent migrations with the same class name as existing migration, so that that there were two auto generated migrations with the same name.

Simply changing the class name of the new migration clears the problem.


i did a little search i had the same problem it's probably beacause your form has two .resx if you try to delete one, the problem will be gone my form:

Form1.Designer.cs
Form1.resx
Log_in.resx
Form1

i deleted Log_in.resx and my program worked again


Make sure you don't have two .resx files. See in your project under YourServiceName.cs. Works for me.


This just happened to me. I had accidentally "Drag and dropped" a form into another. It ended up making a copy of it called "Copy of ". I deleted it and the problem went away.


In my case, the issue was caused by an EmbeddedResource tag for a designer.resx file that somehow got added to the .csproj file.

Specifically, the following:

<EmbeddedResource Include="Forms\frmMenu.designer.resx">
      <DependentUpon>frmMenu.designer.cs</DependentUpon>
</EmbeddedResource>

Search in all project the class reported in error list, like in this question case DryWash.WorkersScreen it could be repeated in another file with different file name but inside same class name.


I got this problem when I accidentally generated a migration with the same name as a business object. The solution is to delete the migration and then create a new one with a different name.


This happened to me when I copied a form to reuse most of the functionality and then renamed the form. I went to the directory referenced, found that there was in fact only one file, copied the file in question, renamed it to reference the name of my new form, and then pasted the new file back in the directory.

I don't think this is a good practice (I'm new to C#) but it did work, instead of having to recreate everything. I also needed to update the form name in a few places throughout the solution, surprising in the original form as well as in the new form.

Copying forms does not seem like a good idea.


This happened to me when I run Add Migration command and gave same name as my project name as migration class. I removed all migration classes and added new one, solution build again.


If this problem appeared while you were working with EntityFramework and was trying to Add-Migration, the solution is simple: delete Migrations folder (in the Solution Explorer) and execute Enable-Migrations. Backup migrations if you need.


I had the issue and it was caused because I had a partial class of a custom control.

I had accidentally created a .resx file for the partial

I think I did this by hitting shift F7 on the partial class and producing the empty designer form.

Removing the .resx file on the partial class resolved it for me. I was using version control and it was showing that it was a new file.

Hope this helps


For me the issue was copying and pasting a .aspx, and not renaming the code behind class files to match the name for the copied aspx file. Changing the code behind and designer class names worked.


I had the same issue, what I did was delete my migration files (via the studio), after I updated the database.


I just got this issue using VS 2019 community edition.

I didn't have duplicate .resx files. I didn't have duplicate .cs files. I couldn't find the solution online.

To fix the problem, I cleaned the solution and then restarted VS. Not sure why, but it worked. Hope this helps.


I confirm WimOmbelets answer given in the comments. This can apparently happen when you rename a class in VS2012 (I never had this in a prior version).

I can't be sure this is the cause, but one thing I did different from my normal way is I used F2 to rename it as opposed to changing it and then pressing control-.


I thought that I would post on at least one random forum after encountering this error in hopes of easing someone elses problems. I searched many google sites and none had my exact problem. My cause was similar, but different in some ways.

I actually had a partial class spread across multiple files. this class was a form class. This was successful in itself and didn't cause a problem. However, this caused the new class to keep its unique file name while maintaining a split 'class Form' code. It was most likely not kosher practice, but none the less it happened at the time. It seemed like a good alternative to get a lot of cluttered code out of the way. Needless to say, next time I will just use regions or some other alternative.

The error then occured when I tried to take the code from the 2nd file and copy/paste into a new non form file with just a class, as I had intended upon essentially turning it into a library and making the code a little more proper and readable. As I didn't know exactly what had caused the error when it happened and had made a small plethora of changes, it took some time to track. Even after reversing the code, I managed to miss a pair of methods.

The methods for the main form containing the class Form with initializeComponent and form constructor (load). A 2nd copy of these methods appeared to result in the same error. Even after deleting the extra code and extra form and resx files. I even tried deleting the legitimate resx file since it was not actively needed. I was unable to effectively track it, because any errors pointed to the legit versions of these code segments. Ctrl+F and backup copies are your friends.

Hope that helps someone


In my option, help delete one *.resx for every form where the error raised

Detail INFO

In our project we have 6 *.resx for every form for localization (DE,GB,SK,RU,SRB) and if i delete (from VS) FormName.sr-Latn-CS.resx than the error disappeared. If i try deleted FormName.en-GB.resx it did not help. Error disappeared just for delete sr-Latn-CS.resx (maybe a designer can not solved two - ). I first saw this error when I migrated project from VS 2010 Win 7 to VS2010 Win 10.


I had the same issue when I renamed one of my Form classes using Ctrl + R + R which VS provides to rename things by default.

Then I somewhat got two classes with the same class name on 2 different files (*.cs).

class Bar { ... } // From Bar.cs
class Bar { ... } // This should've been Foo, from Foo.cs

The two Bar indicating the same resource file that one of them shouldn't.

사소한 문제이지만 cs 파일 을 보면 어떤 파일 을 찾아야하는지 알 수 없기 때문에 원인을 찾기가 어려울 수 있습니다 .

참고 URL : https://stackoverflow.com/questions/13739794/two-output-file-names-resolved-to-the-same-output

반응형