Disable Visual Studio warning CS2008 - visual-studio

I have a visual studio project (VS2012) that just contains some configuration files. When I build I get the following warning:
CSC : warning CS2008: No source files specified [C:\Project\Config\Config.csproj]
Is there any way to disable this warning?

I experienced the same problem with VS2017 (<nowarn> attribute didn't work). Adding an empty VersionInfo.cs prevented the build warning.

Go to the project's property page in your Solution Explorer. On the build tab, you can disable the warning using its warning number.
This describes the options available there: http://msdn.microsoft.com/en-us/library/vstudio/kb4wyys2(v=vs.100).aspx
If you ever have actual code that triggers warnings, it can be disabled like so: http://msdn.microsoft.com/en-us/library/vstudio/441722ys(v=vs.120).aspx

Related

Visual Studio SonarLint extension connected to SonarQube is generating warnings CA0507 and CA0064 and no sonar Sxxx warnings

I installed the SonarLint extension for Visual Studio and connected successfully to our SonarQube server and successfully ran Code Analysis to display sonar issues in VS. So it was working OK but for some reason I am now no longer getting any sonar Sxxx warnings and instead now see the following 2 warnings:
> Warning CA0507 Post-build Code Analysis (FxCopCmd.exe) has been
> deprecated in favor of FxCop analyzers, which run during build. Refer
> to https://aka.ms/fxcopanalyzers to migrate to FxCop analyzers.
>
> Warning CA0064 : No analysis was performed because the
> specified rule set could not be loaded or did not contain any managed
> code analysis rules.
But I am not using FxCop and I am not aware of having done anything to turn it on.
If I check one rule inside "Managed Binary Analysis" the CA0064 warning will go away, but CA0507 remains and still no sonar Sxxx warnings.
The "Run Code Analysis" menu items only apply to the legacy FxCop rules. You don't need to use those menu items for Roslyn-based analyzers (like the C# and VB.NET rules in SonarLint) - Visual Studio will automatically trigger the analysis in the background. See the Microsoft docs for more info.
If you are not seeing Sxxx issues being reported there are a couple of things to look at:
Check whether you have the Enable full solution analysis option checked. If not, VS will only report issues in open files.
You've connected the solution to your SonarQube server so SonarLint will have generated a ruleset based on the Quality Profile. The ruleset will be in the solution-level .sonarlint folder. Check whether the rules you are expecting to report issues are enabled in the ruleset file. If not, update the Quality Profile on the server then close and re-open the solution. SonarLint will detect that the Quality Profile has changed and prompt you to update it.
Try to Compile again the project. With first compilation this errors will appear but with second compilation probably not.
No idea why, but it worked for me.

Cannot compile - unknown flag "-pdbrpc" in "p2"

I'm trying to compile a C++ project in VS 2017. Previously I used VS 2019 but due to it's annoying bugs I moved back to 2017, but now I get and error: unknown flag "-pdbrpc" in "p2". I don't even know what this flag means and I didn't find it in .vcxproj files.
I tried to change my project's config settings to disable optimization, but didn't succeed. Also I searched that error in google but didn't find anything useful. How can I fix this annoying problem?
Had same problem. Disabling Whole Program Optimization fixed it.
You probably forgot to downgrade some projects you depend upon.
Make sure all of your projects (including static libraries you link with) use the same v141 (VS2017) Platform Toolset. It can be visible in the Solution Explorer as Project Name (Visual Studio 2017).
In my case I had a hidden project.default.props that was using $(DefaultPlatformToolset), which started to point to v142 as soon as I installed VS2019.

Visual Studio - How to direct the compilation warnings to a file

During the solution build, the errors/warnings are listed inside the Error List. Is that possible to direct those errors/warnings to a file in addition to the console? Thanks

Have Xamarin Studio treat some warnings as errors

In Xamarin Studio, is it possible to have the compiler treat certain warnings as errors? I would like to elevate the severity of some warning so I am forced to see and deal with them. I am using the Mac version.
If your project is a normal C# project then you can select which warnings you want to be treated as errors in the Build/Compiler page in the project's properties. In the "Additional arguments" field enter:
-warnaserror:CS0123,CS3210
To make the warnings CS0123 and CS3210 be treated as errors.

How can this Visual studio Resource warning be resolved or removed?

Anyone can help us here - we have been having this error for several months and had many a stab to remove it, but we still havnt figured out why its there or how to remove it. How is this warning resolved or removed?
Warning 351 A custom tool 'GlobalResourceProxyGenerator' is associated
with file 'App_GlobalResources\GridLocalization.bg-BG.resx', but the
output of the custom tool was not found in the project. You may try
re-running the custom tool by right-clicking on the file in the
Solution Explorer and choosing Run Custom Tool.
After checking out the csproj file and discussing it in the group, we came up with the following answer:
When the resources were added to the project they were added using the wizard. This wizard added the designer files also, so for each reasource file there was also a .designer file.
This was seen as something that was not needed for the language specific resources and the designer files were deleted.
However the csproj files maintained the custom tool reference.
Deleting this reference (to "GlobalResourceProxyGenerator") for each of these resource files removed the issue.
The issue is that Visual Studio 2010 does not automatically remove this tool reference when the designer files are removed manually, creating this warning.
In my case this was caused by a <LastGenOutput> entry in the csproj file that referred to a non-existent file. Removing that line got rid of the warning.
In Visual Studio 2017 I had the same issue with the following error
Warning A custom tool 'ResXFileCodeGenerator' is associated with file <snip name>, but the output of the custom tool was not found in the project.
Removing the reference to
<Generator>ResXFileCodeGenerator</Generator> within the resource file declaration, fixed the issue.
In VS 2019, I also fixed the error:
Warning A custom tool 'ResXFileCodeGenerator' is associated with file , but the output of the custom tool was not found in the project.
By removing the reference to ResXFileCodeGenerator
found within the project's " .csproj" file!

Resources