MSBuild Error task show up as a warning in VS - msbuild

I have an Error task in a C# MSBuild project. The error shows up as a warning in VS2022, below a huge number of other errors that are directly caused by the Error task halting the build. I'd prefer that the other errors don't show up at all, but failing that, the Error task error should at least be on the top of the list and certainly not a mere warning. How can I fix this?
The Error task looks like this:
<Target Name="ShowError">
<Error Text="ToErrIsHuman" Code="CS0518"/>
</Target>
The Project has InitialTargets="ShowError" to trigger the Error task. The Code attribute does not seem to have any effect.

Error shows up in 4.x .NET Framework projects. Restart Visual Studio to fix.

Related

Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code -1073741515

I am trying to build QGIS open source application in Windows. I used this link for it -> link
But I am getting the error "Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code -1073741515". I think it is about some missing dlls. Also, the error is related(opinion) about crssync.exe because building fails after running that exe file. Additionally, when i tried debug start new instace from Visual studio 2015 it shows me (on console) not loaded 3 dlls but two of them are system one is about OSGeo4W. Then shows a missing dll error on the screen about gdal301.dll and proj_6_3.dll.
I tried to execute crsyync.exe directly. It gave me lots of dll missing error two of them is same with above. I add their locations on the path variable then tried again, problems solved no errors. However when i builded again it gave me same error. When i clicked the error it shows me "Microsoft.CppCommon.targets" file.
<CustomBuild
Sources ="#(CustomBuild)"
BuildSuffix ="$(_BuildSuffix)"
TrackerLogDirectory ="%(CustomBuild.TrackerLogDirectory)"
MinimalRebuildFromTracking ="%(CustomBuild.MinimalRebuildFromTracking)"
TLogReadFiles ="#(CustomBuildTLogReadFiles)"
TLogWriteFiles ="#(CustomBuildTLogWriteFiles)"
TrackFileAccess ="$(TrackFileAccess)"
ToolArchitecture ="$(CustomBuildToolArchitecture)"
TrackerFrameworkPath ="$(CustomBuildTrackerFrameworkPath)"
TrackerSdkPath ="$(CustomBuildTrackerSdkPath)"
AcceptableNonZeroExitCodes ="%(CustomBuild.AcceptableNonZeroExitCodes)"
>
</CustomBuild>
The problem is it can not find the gdal301.dll and proj_6_3.dll in the apps folder. Because it looks at the OSGeo4W\bin folder. When i copied and pasted them into that folder it worked and run the qgis.

ASP.NET Core error on building with NSwag Error MSB3073

When I build the application, I get the following error message
The command "dotnet "C:\Users\Adminuser\.nuget\packages\nswag.msbuild\13.0.6\build\../tools/NetCore22/dotnet-nswag.dll" run /variables:Configuration=Debug" exited with code
-2147450730. Northwind.WebUI C:\Users\Adminuser\Documents\Visual Studio 2017\Projects\NorthwindTraders-master\Northwind.WebUI\Northwind.WebUI.csproj 60
Any Idea how to fix this issue?
Swagger doesn't like it when two or more endpoints in the same Controller share the same name. make use of routing attributes and make sure they are unique.
Try to install NSwagStudio then re open your visual studio.
That's should solve your problem.
If it's still not working
give a look about your output console when you try to compile your project, you should see something like this
1>Executing file 'nswag.json' with variables 'Configuration=Debug'...
1>Launcher directory:
C:\Users\Shadow.nuget\packages\nswag.msbuild\13.1.6\tools\NetCore30
You should have a file called dotnet-nswag.exe in your c:\user...\tools\netcore30 directory.
Put this exe in your environnement path.
Re open visual studio and your error should be gone.

Failure writing debug information: Unable to load DLL 'Microsoft.DiaSymReader.Native.amd64.dll'

I installed a VS2017, tried to develop a first app in VS2017.
File > New Project > Visual Basic > Windows Desktop > Windows Forms App (.NET Framework)
simply tried to run an app with only one label on form, but build error comes up, I clicked on "Yes" then dialogue box appears (image).
Error Code- BC37225
Error Message- Failure writing debug information: Unable to load DLL <br>'Microsoft.DiaSymReader.Native.amd64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Then searched SO, read and tried solutions, but not worked.
What I tried from SO is-
Error while building C# Console Application: Error CS0041 Cannot find a module
(1) installed Microsoft.NETCore.Platforms (nuget package)
(2) installed Microsoft.DiaSymReader.Native.amd64.dll (nuget package)
(3) Unable to load DLL 'Microsoft.DiaSymReader.Native.amd64.dll
in this, solution is available (accepted answer), but I don't know from where to delete these lines of code.
<PropertyGroup>
<Deterministic> true </Deterministic>
</PropertyGroup>
what could be the solution?
When the build errors dialog comes up it asks if you want to run a previous build because the current build will not compile (won't make a new .exe file) Since this is the first run of your program there was no previous build, no .exe. What you need to resolve are the build errors.

Suppress warnings in teamcity not working with msbuild

In short we have teamcity set up with a build project that contains an Umbraco web site.
The build step is pretty basic and setup as a Visual Studio runner type. Everything works and builds fine.
The problem is the build process is VERY slow, and after some digging I found out its because it spends times logging hundreds of the exact same warning (also teamcity never uses the full computer resources available, odd).
Here is one such warning logged:
[AspNetCompiler] d:\TeamCity\buildAgent\work\213321ddb3a6b826\eSignaturUmbracoMVC\umbraco\Dialogs\insertMacro.aspx(99, 0): warning CS0618: 'umbraco.ui' is obsolete: 'Use the ILocalizedTextService instead which is the ApplicationContext.Services'
Its only Umbracos pages making that error. So I thought I could suppress that warning using "/p:nowarn=0618" as a command line parameter in the build step. But it doesnt work. I have tried just about any method I could find but the warning is still not suppressed.
Any suggestions? I am pretty lost here...
How to suppress specific MSBuild warning
msbuild.exe MySolution.sln /t:Rebuild /p:WarningLevel=0 /p:Configuration=Release
^^^^^^^^^^^^^^^^^
Warning
Level Meaning
-------- -------------------------------------------
0 Turns off emission of all warning messages.
1 Displays severe warning messages
2 Displays level 1 warnings plus certain, less-severe warnings, such
as warnings about hiding class members
3 Displays level 2 warnings plus certain, less-severe warnings, such
as warnings about expressions that always evaluate to true or false
4 (the default) Displays all level 3 warnings plus informational warnings

Team Build sends error when trying to compile a Structuremap method

I'm getting a strange error when trying to compile a solution that is using StructureMap on Team Build.
When I try to compile the solution locally on Visual Studio it works fine, but when trying to queue a new build in Team Build I get the following error:
Overload resolution failed because no accessible 'Use' can be called with these arguments:
The line of code that gets this error is the second one:
ForSingletonOf(Of ISessionFactory)().Use(NHibernateSessionFactory.SessionFactory)
Me.For(Of ISession)().lifecycleIs(New HybridLifecycle()).Use(Function(x) x.GetInstance(Of ISessionFactory)().OpenSession())
It's a standard registration for the NHibernate session, so I don't really get why this error pops up.
Thanks in advance for the clues.
Make sure you have the correct version of NHibernate on the build server, and that your hint paths are all appropriately set in your project file. We haven't had this specific issue (as we're not using NHibernate), but we've had weird issues like that being related to version mismatches of "infrastructure" DLLs between local and build.