How to skip analysis of folders in VSCode? - c#

how do you skip analysis of certain folders inside of my Unity-project with VSCode?
I already created a file called ".editorconfig" inside of my root folder.
The file consists of the following content:
root = true
[Assets/_thirdparty/**/**/*.cs]
dotnet_analyzer_diagnostic.severity = none
[Assets/Plugins/Debugging Essentials/**/*.cs]
dotnet_analyzer_diagnostic.severity = none
[Assets/UI/XmlLayout/*.cs]
dotnet_analyzer_diagnostic.severity = none
The strange thing is that it doesn't work because the Roslyn analyzer still analyzes the appropriate .cs-files in my project and throws out some errors and warnings.
So how can I prevent Roslyn from analyzing my folders which I mentioned above? Thanks in advance.

Related

Unable to open all solution projects on Visual Studio 2015 - (Load failed/Unavailable)

I have received, from another development team, an MVC project created on Visual Studio 2015. After unzipping the file and opening the solution with VS 2015 Community, I get various warning messages about missing files and most importantly, projects. The project was developed using Team Foundation server for source control, and I get a warning message when opening it that the server cannot be contacted.
Tackling the problem as possibly missing file paths and the like, I have tried the following:
Deleting .user and .suo files: The 2 projects in question do not have files like that included.
Attempting to reload the projects. This has led to an error message saying that the respective .csproj files for each missing project cannot be found. After this the message next to the project name in parentheses has changed from (unavailable) to (load failed)
Running VS as admin and repeating the above.
Remove and try to add the projects again: I couldn't achieve that as there is no .csproj file in the project's folders. Going in the folders I can find .csproj files, but they are actually .csproj.vspscc files, with the following content in them (in both project's cases):
""{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}
My knowledge on source control and code-delivery-between-teams problems is limited. I have some concerns about this issue before seeing if it can actually be solved:
Is it possible that the code has actually been compromised on purpose by the other team? The fact that there are also missing .cs files might point to that.
Could it be that this is a common problem caused by lazily sharing code?
The people in question insist that there should be nothing wrong with the delivered code.

SonarQube Runner skips JavaScript files in Asp.Net MVC solution

It was a long WTF moment and I could not find any information on the issue, so I decided I put it here.
Setup: Windows 7 x86_64, sonarqube-4.3, sonar-runner-2.4, jre 1.7.0_55-b14
I followed quick start guide to configure Sonar.
I copied sonar-project.properties from a sample to my solution, put it in the directory with .sln, and made necessary adjustments:
sonar.projectKey=org.whatever.project
sonar.projectName=Project
sonar.projectVersion=2.0
sonar.sourceEncoding=UTF-8
sonar.sources=.
sonar.visualstudio.enable=true
Problem: Analysis ran without any exceptions but only C# files were analyzed.
Long story short, following line in config was causing the issue:
sonar.sources=.
After moving sonar-project.properties one level up and changing it accordingly, the problem was resolved.
sonar.sources=src
I think it actually relates to the usage of the Visual Studio Bootstrapper. Can you try the same without it?
Here is what happens: The Visual Studio bootstrapper reads all the <Compile> tags from the *.csproj files to determine which files must be imported. Javascript files are not referenced by <Compile> (as they do not need to be compiled), and will therefore not be imported in SonarQube.
See this related Jira ticket: https://jira.codehaus.org/browse/SONARVS-27

The call is ambiguous between single method i.e extension method

I have an extension method like
public static class Extension
{
public static string GetTLD(this string str)
{
var host = new System.Uri(str).Host;
int index = host.LastIndexOf('.'), last = 3;
while (index >= last - 3)
{
last = index;
index = host.LastIndexOf('.', last - 1);
}
var domain = host.Substring(index + 1);
return domain;
}
}
And I am calling this like
string domain = "." + _url.GetTLD();
I am getting no error at building and clean build.
But I am getting compilation error at run time error saying
The call is ambiguous between the following methods or properties:
'myIGNOU.Extension.GetTLD(string)' and
'myIGNOU.Extension.GetTLD(string)'
I swear that I don't have this extension method placed any where else too in the project.
Why I am getting this error only at run time..?
But if I delete this method then I am getting error at build time not not at run time. Everything works fine without the code of this method.
Here is compilation error page
I had the same problem but for me it solved the problem to remove the own project from the project references. Resharper accidentally added a reference to the compiled binary of the same project. That way I had the same extension class 2 times within my project. During building it couldn't distinguish between the source-version or the binary-version of the extension class.
So basically: Check your project references if it contains a reference to itself.
Answer provided by #shashwat is also a case.
This is not a real solution and I can't explain how did it work but it worked.
I was trying everything in Project Properties, References, bin, obj but nothing helped me really. And I was just trying every option and chose 'Convert to Web Application' from the context menu. Although It was a Web Application itself before. It showed me a warning saying that .designer.cs files will be added to each aspx file and I just clicked OK.
Everything remained same except App_Code folder (where all these classes were) was renamed to Old App_Code and I'd build the project. And now I am not getting compilation error at run time.
I know App_Code folder are meant to Website Project and I was having no issue with this till this time in WAP. But I just realize I should not have App_Code folder in WAP as it is discussed here in a wrox forum (1st point). Author has said here that
App_Code is not supported in a WAP. The App_Code folder is compiled at
run-time; all code in a WAP is compiled at compile / development time. So, when you add an App_Code folder to a WAP. you end up with
duplicate code; for example, a class defined in App_Code will also
show up in the wap DLL. The fix is easy: just name the folder
something else like Classes or CodeFiles.
I have tried it renaming too before conversion but that time it did not work.
I had the same problem. After some research and experimenting, I found that (for whatever reason) visual studio doesn't like extension methods in the App_Code folder. Easiest solution I found was to just change the name of the folder.
I had the same situation. I had a custom grid control for which there was an extension method. The method was only declared in one place. The control had been in use in multiple places throughout my solution with no problems. Then one day, I copied a control that implemented the custom grid control by literally copying and pasting within the same project. Then I just renamed the properties as appropriate. After that the solution wouldn't build quoting the same error as above. I suspect the copy and paste added to the project a reference to itself.
Deleting it resolved the problem.
My issue was similar to what shashwat describes. In my case I put the code file in the App_Code dir, but in order to get intellisense, I set the file itself to compile which likely means that the file was getting compiled at both runtime and compile time. I just moved the file out of App_Code.
I have found this solution in the comments above.
And it helped me.
I have the reference to project A in the project A.
By mistake.
Removeing helps =)

VS2010 Project doesnt build but doesnt show any errors or warnings

Im stumped: 0 Errors, 0 Warnings, 0 Messages but the output window says Build: 1 succeeded or up-to-date, 1 Failed, 0 Skipped
I have two projects, A is a web application, B is a dll referenced by A. B by its self builds ok.
What could be wrong?
In *.sou file there is user preferences and most of time if you change directory(downloading project ) of project those remains unchange. Even some time migration doesn't work properly.So simply deleting *.suo file and re opening project will solve in most cases. Cleaning all bin directories may also help. If none help I think moving project to another place and repeat the steps above will help.
In your situation I think excluding the file cause an override on *.suo file best guess.
I excluded the App_Readme folder from the project and it started building. Not sure why I have to exclude the folder though. The folder was added when i added Glimpse from NuGet.
I had this happen to me too. The problem was I had the following code
Sub Page_UnLoad() Handles Me.UnLoad
objConn.Close()
objConn = Nothing
End Sub
I removed the Page_UnLoad Sub and it compiled and ran as expected.

SVN keeps corrupting files with "<<<<<<< .mine", how to fix?

I've got a Visual Studio C# project which is under version control (SVN).
I've always commited and updated the project without any problems. But a couple of hours ago Visual Studio throws the following error when I try to launch/rebuild the project:
Files has invalid value "<<<<<<<
.mine". Illegal characters in path.
I don't know how to fix this problem. What should I do?
That happens when svn encounters a conflict: You changed a file, the file on the server was changed and it cannot (easily) be merged automatically. You need to decide what is the correct solution now.
Subversion just adds the diff into your source file (and creates files next to it, called OriginalName.mine (unchanged) and OriginalName.rsomething (unchanged, server version)).
Fix the conflict and tell subversion that this is resolved.
just delete the obj folder and it will worked fine.
Remove the code that shouldn't be in the file throwing the error and remove the the three files with extensions .mine, .<somerevision> and .<some_other_revision>. svn updated files that now contain 'conflicts' and you need to resolve these conflicts by hand. Usually this means you edited a file, someone else edited the same file and checked in changes and you didn't pay attention when checking out the changed file.
Delete every thing you have in obj folder .
Remove your obj folder from svn version control . Because on every build it get updated and when other developer commit changes to solution SVN is unable to marge obj folder files and raise error
Files has invalid value "<<<<<<< .mine". Illegal characters in path.
Please read the Basic Usage chapter in the subversion book. It has a section about Merging conflicts by hand which explains the conflict markers you're seeing.
Removing the debug folders worked for me (see comment-not answer above).
I got this after moving 12 folders from one section of svn to a new section. So if you get this after moving a project and the error does not point to an actual file, this is likely your issue.
If you have AnkhSVN or VisualSVN installed resolving this is most likely as easy as right clicking the file in the solution explorer and selecting edit conflict.
This will open the changed file in your merge editor. (See Tools->Options->Source Control->Subversion User tools for AnkhSVN). With a good merge tool like the free to use SourceGear DiffMerge or TortoiseMerge, resolving the conflict is just a few mouseclicks away.
I have had this happen on a large scale where the files get marked resolved but the conflict metadata is still there. I wrote a regular expression for visual studio to find these, for instances where it is not feasible to simply revert the changed files.
http://www.codetunnel.com/blog/post/90/ever-merge-with-svn-and-mess-up-when-resolving-conflicts-read-on
I closed the IDE, then deleted the obj folder and restarted the IDE and rebuilt my Code. This worked for me.
Inside your project :
odj folder -> Debug -> project name.csproj.Filelistabsolute.txt(snb.csproj.Filelistabsolute.txt)
Inside the text file
>>>>>>>.mine and >>>>>>>.r150 occurs
to remove the things the program works
1)Just save your local changes whatever u have edited in the file
2)revert the file
3)update it from SVN
4)Paste your local changes
If you are using TortoiseSVN you should have a right click option on the file called Edit Conflicts. This should bring up TortoiseMerge which is able to read those obnoxious notations stuck into the file (really, to break your code so you KNOW there's an issue and don't blindly check it in).
TortoiseMerge will read it properly and present you with a 3-way merge. This was what I was looking for. Although it is true that it does also create the separate .mine and .rxxx and .ryyy files, and there are various manual and command-line ways to deal with all this.
Have a simple solution. just delete all file from debug folder and rebuild the solution, an error display on the screen "There were build errors. Would you like to continue and run the last successful build? click on "Yes" button. Now stop the program and run normally.

Categories

Resources