Error while building dll for resource file --error CVT1100: duplicate resource. type:DIALOG, name:4159, language:0x0409 - visual-studio-2010

I trying to create dll from resource files.
I have more than 1 .rc file and want to include in dll.
but i am getting following error
error CVT1100: duplicate resource. type:DIALOG, name:4159, language:0x0409
error LNK1123: failure during conversion to COFF: file invalid or corrupt.
I searched a lot but couldn't solved yet.

I may have had the same problem in my project (but I used Visual Studio 2008).
In my case the problem was that in "Project Properties/Linker/Manifest File/Generate Manifest" when in
- "Debug" mode the setting should be "No" (setting to "Yes" generates exactly the same error)
- but when in "Release" mode the setting should be "Yes".

Related

Build InstallShield project outside of Visual Studio

I have created a solution using Visual Studio 2017 which consists of a Windows Service C# Project and an InstallShield 2016 Basic MSI Project.
The InstallShield project has a single component added. This component has a number of files added using the Component->Files->Add File... (below)
Note the use of VSSolutionFolder.
Now when I open the InstallShield project (.ism) using InstallShield 2016, and build the project, I get the following build errors:
Loading File table
ISDEV : error -6103: Could not find file "<VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.exe"
ISDEV : error -6103: Could not find file "<VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.exe.config"
ISDEV : error -6103: Could not find file "<VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.pdb"
ISDEV : error -6103: Could not find file "<VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\App.config"
Building MsiFileHash table
ISDEV : error -6271: File <VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.exe not found. An error occurred building the MsiFileHash table record for this file. Verify that the file exists in the specified location.
ISDEV : error -6271: File <VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.exe.config not found. An error occurred building the MsiFileHash table record for this file. Verify that the file exists in the specified location.
ISDEV : error -6271: File <VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.pdb not found. An error occurred building the MsiFileHash table record for this file. Verify that the file exists in the specified location.
ISDEV : error -6271: File <VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\App.config not found. An error occurred building the MsiFileHash table record for this file. Verify that the file exists in the specified location.
Adding instance transforms to substorage...
ISDEV : error -1007: Cannot copy source '<VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.exe' to target 'E:\Installshield\WebDeploy\Windows Services\ACMECorp.App.Service\ACMECorpSetup\ACMECorpSetup\Default Configuration\Release\DiskImages\DISK1\program files\ACME Corp\ACME Corp Service 0\ACMECorp.App.Service.exe'
ISDEV : error -1007: Cannot copy source '<VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.exe.config' to target 'E:\Installshield\WebDeploy\Windows Services\ACMECorp.App.Service\ACMECorpSetup\ACMECorpSetup\Default Configuration\Release\DiskImages\DISK1\program files\ACME Corp\ACME Corp Service 0\ACMECorp.App.Service.exe.config'
ISDEV : error -1007: Cannot copy source '<VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.pdb' to target 'E:\Installshield\WebDeploy\Windows Services\ACMECorp.App.Service\ACMECorpSetup\ACMECorpSetup\Default Configuration\Release\DiskImages\DISK1\program files\ACME Corp\ACME Corp Service 0\ACMECorp.App.Service.pdb'
ISDEV : error -1007: Cannot copy source '<VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\App.config' to target 'E:\Installshield\WebDeploy\Windows Services\ACMECorp.App.Service\ACMECorpSetup\ACMECorpSetup\Default Configuration\Release\DiskImages\DISK1\program files\ACME Corp\ACME Corp Service 0\App.config'
In Media Path Variables, there is a VSSolutionFolder with a value UNDEFINED.
I cannot change this Current Value - the UI does not allow it. Defined Value cannot be changed and Test Value doesn't seem to do much.
I have the project saved as xml but I only see the VSSolutionFolder referenced in file paths like so:
<row>
<td>acmecorp.app.service.exe</td>
<td>ACMECorpServiceFilesComponent</td>
<td>ACMECO~1.EXE|ACMECorp.App.Service.exe</td>
<td>0</td>
<td/>
<td/>
<td/>
<td>1</td>
<td><VSSolutionFolder>\ACMECorp.App.Service\bin\Debug\ACMECorp.App.Service.exe</td>
<td>1</td>
<td/>
</row>
Is there a way of setting VSSolutionFolder in InstallShield? Or is there some way of fixing this.
Ideally I want it to just load in Visual Studio and InstallShield without having to muck about with source locations - yes I can remove the files and re-add, but that is not the question (if I had a larger solution it wouldn't be acceptable I don't think).
Personally I recommend keeping your application code and your installer code in two different solutions. There are several reasons including:
1) A new version of VS comes out that IS doesn't support yet and you don't want to be held back.
2) Simplifies project dependencies and build order relationships. Build your app code first then build your installer code second.
3) Depending on where you are in the agile/devops spectrum you might want to keep your peanut butter and chocolate separate.
In this scenario I use postbuild xcopy commands and msbuild publish profiles to stage my application code to a "Deploy" directory in the workspace in the directory that your .ISPROJ and .ISM lives. From there InstallShield simply uses the standard ISPROJECTDIR path variable reference. Now you don't have to deal with the complexities of project output references. You have a nice model defined of what your deployed application should look like.
Try overriding the path variable. You can do this either with external approaches like iscmdbld -L... or with the Release Configuration property Path Variable Overrides. (Note that building the solution with MSBuild should already just work.)
If there are problems overriding VSSolutionFolder itself, you can change your file links to use a new standard variable that is defined to use <VSSolutionFolder> as its default path, but will definitely allow you to override it.

Error 1 Unable to copy file "obj\Debug\SourceProject.exe" to "bin\Debug

This is a super weird question for Visual Studio 2013: Windows Forms Application 3.5!
I designed and made the program, then I ran the program for the first time and an error pops up.
And then I click cancel, retry and this time I click yes and this pops up:
Error while trying to run project: Could not load file or assembly
'SourceProject' or one of its dependencies. The located assembly's
manifest definition does not match the assembly reference.(Exception
from HRESULT: 0x80131040)
Any ideas on fixing it?
FULL ERROR LOG
Error 1 Unable to copy file "obj\Debug\SOURCEPROJECT.exe" to
"bin\Debug\SOURCEPROJECT.exe". Access to the path
'obj\Debug\SOURCEPROJECT.exe' is denied. SOURCEPROJECT
Just open your Debug Configuration near by Application Run Button in VS. Then , Choose debug with Any CPU to x64 or x86 .. May be it will help someone.
Thanks,

EmguCV 'Emgu.CV.CvInvoke' Exception

I have installed EmguCV 2.4.2.1777. I have a 32-bit windows 7 so I installed it using the installer. Now I am trying to write a simple code to capture a webcam's video in a window in C#.
The problem is after during execution I am getting the following famous error:
A first chance exception of type 'System.DllNotFoundException' occurred in Emgu.CV.dll
A first chance exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
An unhandled exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
The file Emgu.CV.dll is present in the folder. I don't understand why its giving that error.
I tried all the checks which are suggested by fellow stackoverflow users and also many other references:
1) Installed MSVCR: MSVCRT 10.0 SP1 x86
2) copied the OpenCV dlls to the execution directory
3) I also have a 32-bit OS. So that also should'nt be an issue.
But when I checked for dependencies, I faced a problem:
I used DependecyWalker to open cvextern.dll and found the following dependencies missing:
NVCUDA.DLL
API-MS-WIN-CORE-COM-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL
DCOMP.DLL
IESHIMS.DLL
It also gave the following:
Error: At least one required implicit or forwarded dependency was not found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Please help me out with the exception. Thanks in advance.
I copied all the dll files from C:\Emgu\emgucv-windows-universal-gpu 2.4.9.1847\bin\x86 to a folder called includes in my project and updated the "Copy To Output Directory" Option for these DLLs to "Copy Always" and it got rid of this issue.

LNK1000: Internal error during IMAGE::BuildImage

I have a problem with linking in VC++ 2010. When I compile in the debug mode it's ok, but in the release mode I regular receive the error "LNK1000: Internal error during IMAGE::BuildImage".
What am I doing wrong?
It began work as soon as I have changed "Whole program optimization" option from "Use Link Time Code Generation" to "Profile Guided Optimization-Instrument".
I encountered the same error. The problem in my case was that I was "playing" with the configuration properties (Project Properties -> Configuration Properties -> General)
The 'Configuration Type' of the project was 'Dynamic Library (.dll)', but the 'Target Extension' was .lib instead of .dll.
April 2020 update
Issue with MSBuild and Docker for Windows was fixed in MSBuild 16.5 (source), so if still seeing that - just update MSVS/MSBuild to the latest version
Original answer
Check for working C compiler: C:/BuildTools/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe -- broken
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler
"C:/BuildTools/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
......
LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage.FinalPhase
I was getting this error when I was running cmake in Docker for Windows inside mounted Docker volume. Solution is to copy the workspace to local Docker filesystem.
In vs2019 it works for me:
Project->Property pages->Optimization->Link Time Code Generation, change from "Use Link Time Code Generation" to "Profile Guided Optimization-Instrument"

"Source" parameter of the "MIDL" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem"

I am trying to migrate one of projects earlier in VS2008 to VS2010. On building I get the following error
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(317,7): error MSB4094: "hdxBinding.idl;hdxBlinking.idl;HDXCommandObject.idl;hdxds.idl;HSCProcessStatus.idl;HSCSelectableWindow.idl" is an invalid value for the "Source" parameter of the "MIDL" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".
On clicking this error, it takes me to the line Source ="#(Midl)" inside C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets file
A Code Snippet in Microsoft.CppCommon.targets file:
<ItemGroup>
<Midl Condition="'#(Midl)' != ''">
<MinimalRebuildFromTracking Condition="'$(BuildType)' != 'Build' or '$(ForceRebuild)' == 'true'">false</MinimalRebuildFromTracking>
</Midl>
</ItemGroup>
<PropertyGroup>
<MidlToolArchitecture Condition="'$(MidlToolArchitecture)' == ''">$(DefaultToolArchitecture)</MidlToolArchitecture>
</PropertyGroup>
<MIDL
Condition ="'%(Midl.ExcludedFromBuild)'!='true'"
Source ="#(Midl)"
AdditionalIncludeDirectories ="%(Midl.AdditionalIncludeDirectories)"
AdditionalOptions ="%(Midl.AdditionalOptions)"
ApplicationConfigurationMode ="%(Midl.ApplicationConfigurationMode)"
ClientStubFile ="%(Midl.ClientStubFile)"
CPreprocessOptions ="%(Midl.CPreprocessOptions)"
DefaultCharType ="%(Midl.DefaultCharType)"
DllDataFileName ="%(Midl.DllDataFileName)"
EnableErrorChecks ="%(Midl.EnableErrorChecks)"
ErrorCheckAllocations ="%(Midl.ErrorCheckAllocations)"
ErrorCheckBounds ="%(Midl.ErrorCheckBounds)"
ErrorCheckEnumRange ="%(Midl.ErrorCheckEnumRange)"
ErrorCheckRefPointers ="%(Midl.ErrorCheckRefPointers)"
ErrorCheckStubData ="%(Midl.ErrorCheckStubData)"
ExcludedInputPaths ="$(ExcludePath)"
GenerateClientFiles ="%(Midl.GenerateClientFiles)"
GenerateServerFiles ="%(Midl.GenerateServerFiles)"
GenerateStublessProxies ="%(Midl.GenerateStublessProxies)"
GenerateTypeLibrary ="%(Midl.GenerateTypeLibrary)"
HeaderFileName ="%(Midl.HeaderFileName)"
IgnoreStandardIncludePath ="%(Midl.IgnoreStandardIncludePath)"
InterfaceIdentifierFileName ="%(Midl.InterfaceIdentifierFileName)"
LocaleID ="%(Midl.LocaleID)"
MkTypLibCompatible ="%(Midl.MkTypLibCompatible)"
OutputDirectory ="%(Midl.OutputDirectory)"
PreprocessorDefinitions ="%(Midl.PreprocessorDefinitions)"
ProxyFileName ="%(Midl.ProxyFileName)"
RedirectOutputAndErrors ="%(Midl.RedirectOutputAndErrors)"
ServerStubFile ="%(Midl.ServerStubFile)"
StructMemberAlignment ="%(Midl.StructMemberAlignment)"
SuppressCompilerWarnings ="%(Midl.SuppressCompilerWarnings)"
SuppressStartupBanner ="%(Midl.SuppressStartupBanner)"
TargetEnvironment ="%(Midl.TargetEnvironment)"
TypeLibFormat ="%(Midl.TypeLibFormat)"
TypeLibraryName ="%(Midl.TypeLibraryName)"
UndefinePreprocessorDefinitions ="%(Midl.UndefinePreprocessorDefinitions)"
ValidateAllParameters ="%(Midl.ValidateAllParameters)"
WarnAsError ="%(Midl.WarnAsError)"
WarningLevel ="%(Midl.WarningLevel)"
TrackerLogDirectory ="%(Midl.TrackerLogDirectory)"
MinimalRebuildFromTracking ="%(Midl.MinimalRebuildFromTracking)"
ToolArchitecture ="$(MidlToolArchitecture)"
TrackerFrameworkPath ="$(MidlTrackerFrameworkPath)"
TrackerSdkPath ="$(MidlTrackerSdkPath)"
TLogReadFiles ="#(MIDLTLogReadFiles)"
TLogWriteFiles ="#(MIDLTLogWriteFiles)"
ToolExe ="$(MIDLToolExe)"
ToolPath ="$(MIDLToolPath)"
TrackFileAccess ="$(TrackFileAccess)"
AcceptableNonZeroExitCodes ="%(Midl.AcceptableNonZeroExitCodes)"
YieldDuringToolExecution ="$(MidlYieldDuringToolExecution)"
>
</MIDL>
Can somebody please tell me whats going wrong here. This is driving me crazy!!!!!!
Got a similar error today on a project that I am converting to VS2010. I don't have a good solution to the problem yet, but I have a workaround. In my case, the project contained 2 idl files. Call them A.idl and B.idl. A.idl is the main idl for the project. It includes B.Idl. The error I received was:
error MSB4094: "A.idl;B.idl" is an invalid value for the "Source" parameter of the "MIDL" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem".
It seems that the build system searched for all idl files in the project and made a single call to the MIDL compiler with all of them even though that was bound to fail. I don't know why VS2010 does that and earlier version didn't (or maybe earlier versions of MIDL could handle multiple inputs).
The workaround: grab the MIDL arguments off of MIDL Command Line page of the project's properties. Then run MIDL by hand in a VS2010 Command Prompt window using those args. In my case, since A.idl includes B.idl, I only needed to run one MIDL command:
MIDL options-copied-from-project-properties A.IDL
It looks like you have multiple idl files in your project (hdxBinding.idl, hdxBlinking.idl, etc.). So the same trick might work for you.
Good luck
I ran into this issue trying to build the DataMonitor example from the TMG SDK with Visual Studio 2010. The problem from what I can tell is the MIDL > Output settings in the project - the Header File, IID File, Proxy File, and Type Library were set to "DataMonitor...", which was forcing those settings to be applied to all included IDL files (and not just the project's generated one).
Changing those settings to use %(Filename) instead and the project built fine.
When there are multiple IDL files in the project I converted from VS 2008 to VS 2010, I got this error. Since one IDL I had was included in the other. I disabled building of the included IDL file and it resolved this error.
These errors prop up when migrating to VS2010 as the .idl file properties are not migrated by VS2010 migrator. I got a similar error and resolved this by manually adding these parameters from to VS2010. Once done you will be able to get rid of these build errors.
I run into the same problem as well. The fix was (very confusing) remove empty in the vcxproj file. I run out of time and have not got to the bottom of why it helps - defining not empty HeaderFileName fixes the problem as well, other empty elements do not cause this problem (e.g. DllDataFileName).
If you want to reproduce bug or process of my investigation just create hello world and add two idl files. It should work. However if you add ItemGroupDefinition with Midl.HeaderFileName it should start failing. One wild guess is that it has something to do with batching of tasks (working example calls MIDL task for each file separately).

Resources