This error just seems to happen randomly. I've done an internet search, but nothing turns up. If I clean out the bin, obj, and .vs directories, it will fix it for a few builds and then the error will come back.
1>------ Build started: Project: GridViewOnly, Configuration: Debug Any CPU ------
1>Failed to check the content hash of the destination ref assembly 'C:\Users\myuser\source\repos\GridViewOnly\bin\Debug\net5.0-windows\ref\GridViewOnly.dll'. It will be overwritten.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: The "CopyRefAssembly" task failed unexpectedly.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: System.InvalidOperationException: The "CopyRefAssembly" task has not registered its resources. In order to use the "TaskLoggingHelper.FormatResourceString()" method this task needs to register its resources either during construction, or via the "TaskResources" property.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: at Microsoft.Build.Shared.ErrorUtilities.ThrowInvalidOperation(String resourceName, Object[] args)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowInvalidOperation(Boolean condition, String resourceName, Object arg0)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: at Microsoft.Build.Utilities.TaskLoggingHelper.FormatResourceString(String resourceName, Object[] args)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: at Microsoft.Build.Utilities.TaskLoggingHelper.LogErrorWithCodeFromResources(String messageResourceName, Object[] messageArgs)
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: at Microsoft.CodeAnalysis.BuildTasks.CopyRefAssembly.Copy()
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: at Microsoft.CodeAnalysis.BuildTasks.CopyRefAssembly.Execute()
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(4413,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>Done building project "GridViewOnly.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Add ProduceReferenceAssembly as false in csproj file of your solution
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>
I used the configuration manager to create an x64 configuration and that seems to fix it. I haven't encountered the problem since I did that a couple days ago, anyway. Before, I was just using the default AnyCPU configuration. I wound up deleting it because I know I don't need it.
Related
I have a problem with my brand new instance of JetBrains Rider. After downloading it and creating the template project "ASP .NET Web Application" I get the following error message when trying to download NuGet packages:
Restore failed
Restore failed for 14 packages in 1 project
The log is
[Notification][Restore] Restore failed
Restore failed for 14 packages in 1 project
The packages/ folder does not exist.
I installed a couple of other programms (like the .NET Framework and even Visual Studio), I downloaded the nuget.exe and put it in the PATH environment variable. I moved the project around the hard drive because maybe Rider needs special permissions and even created the folder. Nothing helped so far.
When I type nuget restore manually, I get the following essage:
nuget : Errors in packages.config projects
At line:1 char:1
+ nuget restore
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Errors in packages.config projects:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Unable to find version '3.5.0.2' of package 'Antlr'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Antlr.3.5.0.2' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '1.17.0' of package 'jQuery.Validation'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'jQuery.Validation.1.17.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.3.1' of package 'jQuery'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'jQuery.3.3.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.4.1' of package 'bootstrap'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'bootstrap.3.4.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '1.1.3' of package 'Microsoft.AspNet.Web.Optimization'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Web.Optimization.1.1.3' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '5.2.7' of package 'Microsoft.AspNet.Mvc'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Mvc.5.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.2.7' of package 'Microsoft.AspNet.Razor'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.Razor.3.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.2.7' of package 'Microsoft.AspNet.WebPages'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.AspNet.WebPages.3.2.7' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '2.8.3' of package 'Modernizr'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Modernizr.2.8.3' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '1.0.0' of package 'Microsoft.Web.Infrastructure'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.Web.Infrastructure.1.0.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '1.6.0' of package 'WebGrease'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'WebGrease.1.6.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '3.2.11' of package 'Microsoft.jQuery.Unobtrusive.Validation'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.jQuery.Unobtrusive.Validation.3.2.11' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '2.0.0' of package 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
Unable to find version '11.0.1' of package 'Newtonsoft.Json'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Newtonsoft.Json.11.0.1' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
How can I fix this error message and download NuGet packages in Rider?
It seems downloading the nuget.exe and putting it in the PATH environment variable was correct. Additional, I had to add this to C:\Users<username>\AppData\NuGet\NuGet.config:
<configuration>
<!-- stuff -->
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<!-- other stuff -->
</packageSources>
</configuration>
Then I called nuget restore and the 14 packages were successfully downloaded. I haven't found a manual detailing this steps yet, so I'm not sure if more is missing.
I'm trying to build a solution from command line. This involves 3 steps:
nuget install
nuget restore
msbuild
I am using a NuGet.Config files that specifies where the nuget packages are cached to, and also where the restored packages are added.
The command nuget restore does not work, nor does it provide a helpful error message other than 'the solution can't be built'. Another answer on StackOverflow helpfully recommended to run the msbuild command and see what the error is.
It would seem that files installed via nuget are not found during msbuild (or apparently nuget restore). This is the log from msbuild for every single assembly other than what is found in GAC:
Primary reference "NTRPRS.NLog.Slack".
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "NTRPRS.NLog.Slack". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\Avesta\Services\Dashboard\src\Avesta.DashboardService.csproj]
For SearchPath "{HintPathFromItem}".
Considered "..\..\..\..\AppData\Roaming\NuGet\packages\NTRPRS.NLog.Slack.5.0.4\lib\net45\NTRPRS.NLog.Slack.dll", but it didn't exist.
For SearchPath "{TargetFrameworkDirectory}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\Facades\NTRPRS.NLog.Slack.exe", but it didn't exist.
For SearchPath "{Registry:Software\Microsoft\.NETFramework,v4.5,AssemblyFoldersEx}".
Considered AssemblyFoldersEx locations.
For SearchPath "{AssemblyFolders}".
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\130\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files\IIS\Microsoft Web Deploy V3\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft SQL Server\140\SDK\Assemblies\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\NTRPRS.NLog.Slack.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\ADOMD.NET\140\NTRPRS.NLog.Slack.exe", but it didn't exist.
For SearchPath "{GAC}".
Considered "NTRPRS.NLog.Slack", which was not found in the GAC.
For SearchPath "{RawFileName}".
Considered treating "NTRPRS.NLog.Slack" as a file name, but it didn't exist.
For SearchPath "bin\Debug\".
Considered "bin\Debug\NTRPRS.NLog.Slack.winmd", but it didn't exist.
Considered "bin\Debug\NTRPRS.NLog.Slack.dll", but it didn't exist.
Considered "bin\Debug\NTRPRS.NLog.Slack.exe", but it didn't exist.
How can I specify to msbuild where assemblies installed by nuget are? Also.... why is nuget restore failing? The message I get from nuget restore is:
C:\<path>\src>nuget restore
Error parsing solution file at C:\<path>\src\<name>.sln: Exception has been thrown by the target of an invocation.
The project file could not be loaded. Could not load file or assembly 'System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified. C:\<path>\src\<name>.sln
using:
MSBuild auto-detection: using msbuild version '15.7.177.53362' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin'.
As far as I can tell, the nuget error output is completely nonsensical. The absolute path C:\<path>\src\<name>.sln absolutely does exist.
This is a problem that only surfaced after 15.7.0 of Visual Studio / MSBuild.
NuGet already has an open issue for this problem: https://github.com/NuGet/Home/issues/6918
The current workaround is to install .NET 4.7.1 until the problem is fixed, because that will install the missing library in the Global Assembly Cache.
We are currently having problems while compiling a solution with MSBuild. The build fails randomly on the resource linking step inside the task "AL" which executes the "AL.exe" linker.
ALINK : error AL1019: Metadata failure while creating assembly -- The volume for a file has been externally altered so that the opened file is no longer valid.
The build log shows the following execution flow.
4>Target "GenerateSatelliteAssemblies" in file "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets" from project "C:\source\MyProject.csproj" (target "CreateSatelliteAssemblies" depends on it):
4>Building target "GenerateSatelliteAssemblies" completely.
4>Output file "obj\Debug\de\MyProject.dll" does not exist.
4>Task "MakeDir"
4>Done executing task "MakeDir".
4>Task "AL"
4> C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\AL.exe /culture:de /out:obj\Debug\de\MyProject.resources.dll /template:obj\Debug\MyProject.dll /embed:obj\Debug\MyProject.SomeResource.de.resources
4> Microsoft (R) Assembly Linker version 14.0.0081.0
4> Copyright (C) Microsoft Corporation. All rights reserved.
4>
4>Done executing task "AL".
4>Done building target "GenerateSatelliteAssemblies" in project "MyProject.csproj".
4>Target "GenerateSatelliteAssemblies" in file "C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets" from project "C:\source\MyProject.csproj" (target "CreateSatelliteAssemblies" depends on it):
4>Building target "GenerateSatelliteAssemblies" completely.
4>Output file "obj\Debug\en\MyProject.resources.dll" does not exist.
4>Task "MakeDir"
4>Done executing task "MakeDir".
4>Task "AL"
4> C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\AL.exe /culture:en /out:obj\Debug\en\MyProject.resources.dll /template:obj\Debug\MyProject.dll /embed:obj\Debug\MyProject.SomeResource.en.resources
4> Microsoft (R) Assembly Linker version 14.0.0081.0
4> Copyright (C) Microsoft Corporation. All rights reserved.
4>
4>ALINK : error AL1019: Metadata failure while creating assembly -- The volume for a file has been externally altered so that the opened file is no longer valid.
4> The command exited with code 1.
4>Done executing task "AL" -- FAILED.
4>Done building target "GenerateSatelliteAssemblies" in project "MyProject.csproj" -- FAILED.
To me it is completely unclear what is meant by the error code AL1019. The MSDN error code listing didn't help either.
I have a FAKE build script which will run perfectly fine if I build the project once using VisualStudio, but if I try and do a fresh build then it throws errors saying it can't find the namespace of both a number of nuget packages and my dependant visual studio projects.
I'm using FAKE's MSBuildRelease and passing in the .sln file like so:
Target "BuildWindowsProject" (fun _ ->
MSBuildRelease
""
"Build"
[ "./Source/My.Project.sln" ]
|> Log "Windows-Build: "
)
It's giving out a number of errors such as below, but these include both projects within the solution and external nuget packages.
The type or namespace name 'Caliburn' could not be found (are you missing a using directive or an assembly reference?)
I did notice that back in 2011 this was posted - MSBuild cannot find a reference but it's quite old and I can't find any more recent occurrences of the issue online.
It works just fine if I do a visual studio build first and then run my build script but this doesn't solve the problem for a build server. What am I doing wrong?
You have to perform deep diagnostic by yourself, because the question under consideration requires the source code to be published here. It also can depend on the environment where the script is running, in order to get you the right answer.
You have an option on MSBuild utility to pass verbosity level of output. Use the following switch value to get detailed information about how the references are resolved during the build:
msbuild ./Source/My.Project.sln /t:Build /v:d
Using this command, you can navigate to the steps called ResolveAssemblyReference and ResolveProjectReference. You can see all the paths, where it will search for assemblies, and if it is succeded:
4> Primary reference "System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
4> Resolved file path is "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Runtime.Remoting.dll".
4> Reference found at search path location "{TargetFrameworkDirectory}".
4> For SearchPath "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib\amd64".
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib\amd64\System.Runtime.Remoting.winmd", but it didn't exist.
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib\amd64\System.Runtime.Remoting.dll", but it didn't exist.
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib\amd64\System.Runtime.Remoting.exe", but it didn't exist.
4> For SearchPath "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64".
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\System.Runtime.Remoting.winmd", but it didn't exist.
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\System.Runtime.Remoting.dll", but it didn't exist.
4> Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\System.Runtime.Remoting.exe", but it didn't exist.
4> For SearchPath "{TargetFrameworkDirectory}".
4> Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Runtime.Remoting.winmd", but it didn't exist.
4> This reference is not "CopyLocal" because it's a prerequisite file.
4> The ImageRuntimeVersion for this reference is "v4.0.30319".
You also can examine which references were passed to the compiler if you look at commandline, which was generated by MSBuild and find out if there is a reference you are required in.
For cl:
4> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\CL.exe
...
/AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
...
/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll"
/FUE:\YourProj\bin\Debug\Your.Proj.dll
/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Configuration.dll"
...
/errorReport:prompt
YourSourceCodeFiles.cpp
/clr:nostdlib
For csc:
2> C:\Program Files (x86)\MSBuild\12.0\bin\Csc.exe
...
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\mscorlib.dll"
/reference:E:\svn\PRM\trunk\PRM30\bin\Debug\Prm.Base.dll
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Configuration.dll"
/reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.Core.dll"
...
(most of parameters were omited for simplicity)
I have a .NET library for which I'm writing a C++/CLI wrapper to expose the public members to native world. One of the requirement is to make use of CComBSTR for strings and avoid the std namespace altogether.
For this purpose, I included the atlbase.h header file to use CComBSTR. Everything worked fine as far as the wrapper or its unit tests were concerned. But when I tried using the wrapper headers and libs in an existing project, I noticed a high number of compilation errors all originating from files that don't directly belong to the project I'm compiling. I'm posting a few of them below:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(560): error C2039: 'vt' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(561): error C2039: 'vt' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(932): error C2039: 'vt' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(933): error C2039: 'bstrVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(935): error C2039: 'bstrVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1798): error C2039: 'cVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1798): error C2065: 'cVal' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1808): error C2039: 'bVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1808): error C2065: 'bVal' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1818): error C2039: 'pcVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1818): error C2065: 'pcVal' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1828): error C2039: 'pbVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1828): error C2065: 'pbVal' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1838): error C2039: 'iVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1838): error C2065: 'iVal' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1848): error C2039: 'piVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1848): error C2065: 'piVal' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1858): error C2039: 'uiVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1858): error C2065: 'uiVal' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1869): error C2039: 'puiVal' : is not a member of 'tagVARIANT'
c:\program files (x86)\microsoft visual studio 12.0\vc\include\oaidl.h(455) : see declaration of 'tagVARIANT'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1869): error C2065: 'puiVal' : undeclared identifier
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\include\atlcomcli.h(1880): error C2039: 'intVal' : is not a member of 'tagVARIANT'
I tried a couple of suggestions like the one in https://answers.unrealengine.com/questions/56125/problems-with-including-atlbase-in-ue4-onlyproblem.html but it didn't help. I would prefer not having to make any changes to application project but instead do something in the wrapper project itself that resolves these compilation errors.