Error with schemaVersion of Azure Project - c#

I have an Azure project in TFS that used to work well.
I've just get the latest version and rebuilt the project and now I get the following version:
Error 131 The XML specification is not valid: The 'schemaVersion' attribute is invalid - The value '2013-10.2.2' is invalid according to its datatype 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition:SchemaVersion' - The Enumeration constraint failed. D:\TFS_BOIRA\PROPPOSV3\BACKEND\ServiceLayer.Azure1\ServiceDefinition.csdef 2 125 ServiceLayer.Azure1
The same configuration in another computer works well.
I have checked the version of Azure Tools of both computers and we have different versions.
In my computer (Where I get the error) I have azure tools 2.3, whereas in the other computer where it works well the version is 2.2.
May it be a problem of azure tools versions?
When I add the role to the Azure cloud project, the assemblies:
Microsoft.WindowsAzure.Diagnostics
Microsoft.WindowsAzure.ServiceRuntime
are updated to version 2.3.0.0, and I need them in version 2.2.0.0.
Do I have to reinstall my azure tools to the version 2.2?
Thanks

In addition to Ingrid's answer, you need to get the latest schema version within the ServiceDefinition (.csdef) and ServiceConfiguration (.cscfg) files, and it is not good enough to just change the raw version value (e.g. 2.3), you also need the new version date:
2.3: schemaVersion="2014-01.2.3"
2.4: schemaVersion="2014-06.2.4"
<ServiceConfiguration serviceName="MyCoolCloudProjectName" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="4" osVersion="*" schemaVersion="2014-06.2.4">
<ServiceDefinition name="MyCoolCloudProjectName" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-06.2.4">

You need to keep this in sync if you are working on two different machines. Either bring both up to 2.3 or revert. Keep in mind that as part of upgrading it may have changed config files which you haven't checked in yet.

Finally what it worked for me was reverting the version of Azure Tools, as #Steve Newton has said.
How to revert the version it tis explained here:
http://social.msdn.microsoft.com/Forums/en-US/8701b03a-804f-4953-9ea0-01064aa4dc16/downgrade-from-18-tools-to-17?forum=azuretfs.
What I did was:
1.Modify the .ccproj file: the following two tags changing 2.3 to 2.2.
< ProductVersion>2.2< /ProductVersion>
< CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Windows Azure Tools\2.2\< /CloudExtensionsDir>
2.Open the files ServiceConfiguration.Cloud.cscfg and ServiceDefinition.csdef and change the version there.

I have the same kind of error
[my config: java/eclipse or jenkins/azure eclipseplugin/azure sdk]
ServiceDefinition.csdef (2, 128): Error CloudServices051 : The XML specification is not valid: The 'schemaVersion' attribute is invalid - The value '2014-06.2.4' is invalid according to its datatype 'http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition:SchemaVersion' - The Enumeration constraint failed.
I had no error on my workstation using Eclipse or console but I got this error on my Jenkins instance. It was maybe a difference between SDK. I updated both ( jenkins and my workstation) with the same SDK version but I keep this error... :(
The only workaround I found to have a success build was to remove this attribute from ServiceDefinition.csdef root element.
<ServiceDefinition xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" name="AzureDeploymentProject">
In my build I keep the following warning but the package is build with success.
ServiceDefinition.csdef: Warning CloudServices040 : The 'schemaVersion' attribute is unspecified. Please set the attribute to avoid this warning.

Related

HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure after upgrading to ASP.NET Core 2.2

After upgrading my project to ASP.NET Core 2.2, I tried to run the application (locally of course) and the browser displayed an error message like in the below screenshot.
no more errors notified by visual studio error explorer. I don't know what's happen.
In my case, I upgraded some nuget packages to net core 2.2, but I did not have the net core 2.2 sdk installed, so I went to net core website to download the latest sdk or runtime package, and then I did a net stop was /y and then a net start w3svc in the CMD as administrator. Problem solved for me.
I encountered this error after trying to publish from VS2017 to the production Windows 2016 server. (It worked fine in IIS Express on my local Win10 PC.)
I updated packages, all versions matching and updated in my code, .net core versions matching, restart IIS, rebooting... no joy.
In the Publish > Configure > Settings (left tab) I had to set the Target-runtime from "Portable" to "win-x64" (or whatever is relevant to your environment). I also opted to "Remove additional files at destination."
"Portable" is the default setting. I'm not sure what it takes for the "Portable" runtime to work properly, but might save someone else some time if a "Portable" runtime is not something you need.
Generally speaking, I get this error if something is mismatched in my environment. For example, one time I was upgrading one of my projects to .Net Core 3.1 from 2.2 and hadn't installed the ASP.NET Core Runtime Hosting Bundle on my server:
https://dotnet.microsoft.com/download/dotnet-core/3.1
Also, you can get this error if your Application Pool is set to True for Enable 32-Bit Applications. Try:
IIS Manager > Application Pools > app pool name > (right click) Advanced
Settings > Enable 32-Bit Applications = False
I ran into this issue and had a different solution. For me it was that I had a package that was out of date with the application (I had updated it on NuGet, and the library hadn't been replaced in production). Updating the package fixed it for me.
Note with this: I had to manually run dotnet.exe with the project dll in order to see the message that fixed it for me.
Hope this helps someone else down the road.
you have 2 solution(this answer works on windows server I do not know anything about linux server).
first:
copy all folder(except bin and obj folder) of your project to server
open cmd in your project folder then run this command: dotnet run then all warning and error show to you(if you have error about above command not recognize download dot net core sdk from this link)
second:
you must changed hostingModel attribute from OutOfProcess to
inprocess in web.config and you can change stdoutLogEnabled to true
value for get your project error in logs folder
read your projects errors and fix those.
in my case web.config is:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\BMS.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
</system.webServer>
</location>
</configuration>
and I change it to:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\BMS.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
In my case it was the log level set incorrectly in the appsettings.json. Instead of Warning I've had Warn and this crashed the app with above error.
Seems that everyone has a different answer for this. I also had this issue as well. There are many different things as you can tell that cause this issue. If you don't find any of these solutions helpful or have issues trying to go through all these different solutions, you can try running your application from the command line from the publish folder.
After publish, if you receive this error, go to your publish folder, and then open a command/terminal window, after that type dotnet .\YourStartupProject.dll, you should receive an exception error, which should make fixing the issue easier.
For example, this is an error I received on trying on a new environment without setting up a SQL server, and of course, would receive this error.
Application startup exception: System.Exception: Could not resolve a service of type
'YourStartupProject.DataServices.DbContext.DbContext' for the parameter
'context' of method 'Configure' on type 'YourStartupProject.Startup'. --->
System.ArgumentNullException: Value cannot be null.
Parameter name: connectionString
Once you resolve your error, try it again, rinse, repeat.
For me the issue was caused by dotnet publish creating a web.config entry stdoutLogFile=".\logs\stdout". The correct value should be stdoutLogFile="\\?\%home%\LogFiles\stdout".
MSDN reference: https://blogs.msdn.microsoft.com/waws/2018/06/10/troubleshooting-http-502-5-startup-issues-in-azure-appservice-for-asp-net-core-websites/
This could be a bug in the ASP.NET Core 2.2.0 runtime which may have been fixed in a later version.
Follow this steps:
create a directory in root of your project : logs/stdout
open the web.config file from root of your project and find this line:
<aspNetCore processPath=".\web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
set stdoutLogEnabled as true and save it
reload your app and see the logs in the directory : logs/stdout
I ran into this issue today with my hosting - locally everything is ok but once I publish, I get this error.
I looked through the packages and found out that some .net core stuff was upgraded to 3.0 preview.
Then I changed the build option in VS2019 from "Framework-Dependent" to "Self-contained". It took 5 times longer to build and publish but now it works.
Now I'm checking with host tech support what might be an issue - officially they support 2.1 / 2.2 only, so this might be these packages from 3.0 Preview, however target build is 2.2.
My issues was malformed appsetttings.json file. I enabled standard out logging via web.config and was able to get the underlying exception throwing this error.
If resetting the project and manually copying Program and Startup classes worked for you, then something was clearly messed up. There are some bigger underlying problems with this. Using the OutOfProcess hosting model is okay, but with .Net Core 2.2 you should be able to use the InProcess hosting model, since it is naturally faster: everything is processed in IIS, without an extra HTTP-hop between IIS and your app's Kestrel server.
If you right-click your project file in the visual studio solution explorer, please make sure that AspNetCoreModuleName tag has AspNetCoreModuleV2 value (as opposed to the older AspNetCoreModule). Also, examine Windows Application Event Log to identify the potential culprit. Even though error messages there are somewhat cryptic, they might point you to the exact line number in the code that caused the failure.
Finally, in case you use CI/CD with TFS, there may be environment variable(s) in appsettings.json file that were not properly replaced with the actual values (URLs, etc.).
Looks like i had the same issue. It's happens because if you don't have global.json file in solution, then VS build(publish) .net core app with the last version that installed on your pc. So, i do the next solution:
add a global.json file with .net core version.
{
"sdk": {
"version": "2.2.402"
}
}
From learn.microsoft.com:
global.json can be placed anywhere in the file hierarchy. The CLI searches upward from the project directory for the first global.json it finds. You control which projects a given global.json applies to by its place in the file system. The .NET CLI searches for a global.json file iteratively navigating the path upward from the current working directory. The first global.json file found specifies the version used. If that version is installed, that version is used. If the SDK specified in the global.json is not found, the .NET CLI rolls forward to the latest SDK installed. Roll-forward is the same as the default behavior, when no global.json file is found.
https://learn.microsoft.com/en-us/dotnet/core/versions/selection
This happened to me when I deployed code using Entity Framework Core with migrations, and there was mismatch between the state of the database and the migrations in the code.
This happened to me first time publishing an Azure Web App. Here is how I solved it:
Browse the site using Kudo/FTP. In the root folder there is a LogFiles folder where you find eventlog.xml. In this file I could see that my web app had an SqlException when Entity Framework Core was trying to setup the database, which lead me to check the database permissions (which was the problem for me).
This is what worked for me:
- I ran the startup file of the project in the deployed (IIS) folder. Note that: this will not solve the problem but will inform you about what the problem is. In my case, the cause of the problem was a database migration that failed
Another answer that might help other people in the same case: we have an AppService on Azure where there are 3 NETCore project deployed on 3 different path:
One for Web (/webapi)
One for Mobile (/mobileapi)
One for Functions serverless, in our case was it was AzureFunctions (/functionapi)
Since the upgrade to NETCore3.x, we understood that the hosting model by default was "In-Process" so we had to edit the .csproj file to explictly set the hosting model to "Out-Of-Process" like this:
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
But it was not enough: in fact, we also have to edit Program.cs. Why ? Because in Program.cs the one generated by default in NETCore3.x you have the following code:
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.ConfigureKestrel(o => o.AddServerHeader = false);
});
}
When we replaced this by the old code by NETCore2.x version like below:
public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseKestrel(options => options.AddServerHeader = false)
.UseStartup<Startup>();
}
After deployment, the error 502.5 ANCM Startup Failure was gone :) Hope this answer can help other people.
BTW I know this post is related to NETCore2.2, we also met the same problem but we decided to switch to NETCore3.1 because NETCore2.2 was no more supported and this version was also buggy on some other points.
My .NET Core site was worked fine, but after a while, I got this error (HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure ...);
I tried different methods. Finally I Add new web site in IIS (with other port), then the error was solved.
I got this issue in ASP.NET Core 2.2 project and its resolved for me just by Clean and Rebuild project.
This error started appearing on our Dev server. I had been using this publish command which creates a "self-contained" folder of files for deployment.
dotnet publish -c release -r win7-x64 --output:bin/self_contained
My fix was to instead publish a "framework-dependent" deployment using the following command:
dotnet publish --output:bin/framework_dependent
The dev server did have a few versions of .NET Core installed (2.2.3 and 2.2.5) in this folder *C:\Program Files\dotnet\shared
I am still not clear on why the self contained publish does not work. You might think the self contained publish would be the more reliable method, but in my case it was not.
This .NET Core blog post was helpful.
I got this same error while deploying .Net core app which was targeting .Net framework on Windows server. I checked event viewer on the server and turns out server didn't have .net 4.7.2 installed.
Installing it resolved issue for me.
Yet another scenario that caused this issue for me:
I am running the app pool identity with a service account and I had to run dotnet dev-certs https under this user to get rid of "System.InvalidOperationException: Unable to configure HTTPS endpoint." during startup.
Be carefull publishing.
When i publish it to my PreProd envitoment this conf works well:
Portable
But on my Prod enviroment that conf does not work. I had to choose the especificated one:
win-x64
I dont know the reason about that. If someone know i'll gratefull to know!
The problem occurs when I try to deploy the asp.net core (out-of-process hosting model) website to windows server 2012r2 IIS in production env.
I fixed this with this solution:
Change application pool identity to administrator.
Same failture happent on project publish.
The issue ralated with the latest Microsoft.AspNetCore.App package. Just downcast it from from 2.2.x to 2.2.0
or goto dotnet.microsoft.com/download/dotnet-core/2.2 and get newest dotnet-hosting installer
I was also getting the same issue. And when I looked at the Output window of my solution.
Then I was able to see a different error, which is "The target process exited without raising CoreCLR started event", to fix this I had to remove the Microsoft.AspNetCore.All from my Nuget Packages and install Microsoft.AspNetCore.App. I also had to install the correct .Net SDK from here. Once this is done, restarted my machine and open the solution, the error was gone. Hope it helps
If you are working with ASP.Net Core version 2.2 then in appsettings.json just comment the line -
"AllowedHosts": "*"
it resolves the issue. My application working fine.
This error can be happened because of many reasons. In my case it was an exception due to invalid format of appsettings.json . How I found out is by enabling stdout log in web.config.
For me the issue was a missing appsettings.json
I select the appropriate appsettings.json file (appsettings.production.json or appsettings.development.json) based on an environment variable. Turns out the appsettings.json is required even if you dont use it.
My problem was with the web.config file after publishing. The processPath in the aspNetCore tag was missing the file extension. In my case it was .exe
In my case EF Migrations thrown exception about blocking executing one of them because of a potential data loss.
I had to look into custom app logs (most often Log folder) to find out that.
I guess the Error mentioned in the Question is due to problems during app start stage. And indeed the migrations are run during starting an app, so if they fail the app is not able to complete starting.
So in general when we get such Error we should focus on things that impact on starting logic of the app.

Teamcity, MSBUILD ExtensionPack.Framework.AssemblyInfo task fails

It seems like everything has broken overnight at the same time... sigh.
In a desperate attempt to fix other random problems I need to make a build of our large project only to find that our teamcity build agents can no longer do their job. The error message is below:
[CallTarget] Version (1s)
[Version] MSBuild.ExtensionPack.Framework.AssemblyInfo (1s)
[MSBuild.ExtensionPack.Framework.AssemblyInfo] I:\BuildAgent-DEVTC1\work\e7d35660eba50bd6\build.proj(150, 3): error MSB4018: The "MSBuild.ExtensionPack.Framework.AssemblyInfo" task failed unexpectedly.
System.ArgumentNullException: Value cannot be null.
Parameter name: input
at System.Text.RegularExpressions.Regex.Matches(String input)
at MSBuild.ExtensionPack.Framework.Version.ParseVersion(String version) in D:\Projects\MSBuildExtensionPack\Releases\4.0.3.0\Main\Framework\Framework\AssemblyInfo\Version.cs:line 51
at MSBuild.ExtensionPack.Framework.AssemblyInfo.Execute() in D:\Projects\MSBuildExtensionPack\Releases\4.0.3.0\Main\Framework\Framework\AssemblyInfo\AssemblyInfo.cs:line 1011
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
The proj definition for the Version target is the following where #VersionDefinition is an "inlcude" for all AssemblyInfo.cs files:
<Target Name="Version">
<MSBuild.ExtensionPack.Framework.AssemblyInfo
AssemblyInfoFiles="#(VersionDefinition)"
AssemblyVersion="$(BUILD_NUMBER)"
AssemblyCopyright="Copywrite info here"
AssemblyCompany="Company info here"
AssemblyFileVersion="$(BUILD_NUMBER)"/>
</Target>
I can see that teamcity is correctly passing in BUILD_NUMBER with a valid value too.
Any ideas?
I'm open to suggestions that don't rely on the extension pack to set AssemblyInfo.cs numbers. I have looked into the TeamCity Assembly Info Patcher but I wasn't sure what "standard locations" was referring to in its description.
On a side note, have there been any updates recently to windows or .NET that could have broken everything...everywhere? I have recently had numerous third party libraries start to fail, almost simultaneously.
Thanks
UPDATE
The logs for recent successful build do not even show the Version target being called... which is odd given that that's the only place the correct build number is set and the build created files with the correct number applied.
So I installed a newer version of the ExtensionPack (4.0.13.0) on to the build clients and got a slightly clearer error message that told me which file was at fault.
Examining the AssemblyInfo.cs file mentioned the AssemblyVersion and AssemblyFileVersion values were missing. Adding these solved the issue.
The interesting part here is that the suspect project has not been touched for years so the values had never have been set. A quick scan through our git logs confirms this. Ultimately I'm not sure what triggered this to become a problem but it is no longer.

Powershell fails to find its dll or dependency in VS 2013 Package Manager Console

I'm using VS Express 2013 .Net 4.5. I'm designing in MVC5 and EF6 with MS SQLServer LocalDB in an Oracle VirtualBox Windows 7 64bit client.
I am trying to apply SQL Server LocalDb migrations with the command:
PM> Enable-Migrations -ContextTypeName SGHWA_MVC.Models.Context
This always fails.
My limited web knowledge is with Web Forms so I am completely new to MVC and EF. Also I have never used PMC and Powershell. I have searched for solutions but have not found questions similar to this error that Package Manager Console produces.
First there is a warning:-
Cannot determine a valid start-up project. Using project 'SGHWA_MVC' instead. Your configuration file and working directory may not be set as expected. Use the -StartUpProjectName parameter to set one explicitly. Use the -Verbose switch for more information.
PCM drop-down box shows the Default project correctly as SGHWA_MVC. The solution property pages show this one project as the start-up project.
I went to http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference but could not see the -StartUpProjectName parameter mentioned. I'm not sure to which command this parameter applies.
Then the first error appears:-
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file://\W7O2007\Users\Admin\Documents\Visual Studio 2013\Projects\SGHWA_MVC\packages\EntityFramework.6.1.0\tools\EntityFramework.PowerShell.Utility.dll' or one of its dependencies. Operation is not supported.
(Exception from HRESULT: 0x80131515)"At \W7O2007\Users\Admin\Documents\Visual Studio 2013\Projects\SGHWA_MVC\packages\EntityFramework.6.1.0\tools\EntityFramework.psm1:780 char:62
+ $utilityAssembly = [System.Reflection.Assembly]::LoadFrom <<<< ((Join-Path $ToolsPath EntityFramework.PowerShell.Utility.dll))
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
It suggests the file is not there to be loaded but it does exist on the PC at the path shown. I suspect it is the Join-Path that fails but am unsure how to test this.
The packages.config files has a line:-
(leading < removed) package id="Powershell.Deployment" version="1.1.0.0" targetFramework="net45" />
My research shows it could be permissions, remote access, that the Project Build should have Generate Serialization Assembly as 'On', 'Off' or 'Auto' or even NuGet packages that cause this but I cannot determine if it is a PMC, NuGet, Powershell or Windows problem.
Two more error messages appear relating to similar problems in EntityFramework.psm1 and seem to be related to this first problem.
Please can anyone advise the likely cause and guide me through what/how to test and solve this?
I realize this is an old thread, but I just ran into this problem using a newly-installed copy of Microsoft Visual Studio 2015 Enterprise with Update 1.
My solution was to delete this folder:
C:\Users\\(my user ID)\\.nuget\packages\EntityFramework\6.1.3
and allow it to be regenerated the next time the Entity Framework is added to a project. Originally, the PowerShell DLL's were missing from this folder. Strange.
Your question has several parts.
First, you cannot find the documentation, and you have it at your fingertips:
Update-Database -?
Then, you can read at the bottom of this help:
TO see the examples, type: "get-help Update-Database -examples".
For more information, type: "get-help Update-Database -detailed".
For technical information, type: "get-help Update-Database -full".
Second, -StartupProjectName is required to find the configuration file that has the required connection string (you also specify the connection directly using another options) NOTE: This has nothing to do with the solution's startup project
And, if having this clear doesn't solve the problem, try uninstalling and reinstalling the EntityFramework package (in case something went wrong). Take into account that, if you have several projects, it's possible that you need to do this for all the affected projects. You can do this more easily using the Manage Nuget Packages for Solution... menu option.
Edit
(Added to help choose the right Default project in Package Manager Console or specify -ProjectName).
I forgot to answer the most important part of the question: for Migrations commands to work, it's necessary to run them on a project that references the EF assemblies. This solves the missing assembly problem.
In this case it's clear that the chosen StartUpProject, which is the Web App have the connection strings, but doesn't have a reference to EF. That's why running the command fails. And most probably the command is being run with this as the default project in the console.
To solve this, you need to run Migrations within a project which has references to EF, and it will work flawlessly: choose that project in the drop down list named "Default project" on the top bar of the Package Manager Console.
This can also be done by specifying the -ProjectName option, which must point to the project containing the Migration configuration class, and thus, have also the reference to EF. NOTE: you must also sepcify the -ConfigurationTypeName param if you have several migrations for several contexts, as supported from EF 6.

Sonar C# plugin not working?

Our company was glad to see the release of the C# plugins for sonar, and jumped on the first release. However, we seem to be running into an execption reported by the ProjectLinkSensor. Here's what we did:
On a Windows XP machine, we installed the following:
Windows 7 Development kit (to get to FxCop)
Fxcop 10.0
Gallio
Sonar 2.9 RC1 (running the Derby database)
Maven
2.2.1
Then we checked out the solution, and placed the following pom.xml in the directory where the sln file is:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.rolfje</groupId>
<artifactId>SomeSilverlightProject</artifactId>
<version>1.0-SNAPSHOT</version>
<name>SomeSilverlightProject</name>
<properties>
<sonar.language>cs</sonar.language>
</properties>
<build>
<sourceDirectory>${basedir}</sourceDirectory>
</build>
</project>
In the home directory of the user that's running the maven build we've placed the following settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>dotnet</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.gallio.mode>skip</sonar.gallio.mode>
<sonar.gallio.installDirectory>C:/Program Files/Gallio</sonar.gallio.installDirectory>
<sonar.fxcop.mode>skip</sonar.fxcop.mode>
<sonar.fxcop.installDirectory>D:/Program Files/Microsoft Fxcop 10.0</sonar.fxcop.installDirectory>
<sonar.partcover.mode>skip</sonar.partcover.mode>
<sonar.partcover.installDirectory>C:/Program Files/PartCover/PartCover .NET 4.0</sonar.partcover.installDirectory>
<sonar.gendarme.mode>skip</sonar.gendarme.mode>
<sonar.gendarme.installDirectory>C:/Program Files/gendarme-2.6-bin</sonar.gendarme.installDirectory>
<sonar.gendarme.mode>skip</sonar.gendarme.mode>
<sonar.stylecop.installDirectory>C:/Program Files/Microsoft StyleCop 4.3.2.1</sonar.stylecop.installDirectory>
<sonar.jdbc.url>jdbc:derby://localhost:1527/sonar</sonar.jdbc.url>
<sonar.jdbc.driver>org.apache.derby.jdbc.ClientDriver</sonar.jdbc.driver>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<sonar.host.url>http://localhost:9000</sonar.host.url>
</properties>
</profile>
</profiles>
</settings>
Please note that I put "skip" in front of all modules. I did this one by one, hoping that switching off one of these modules would remove the error and I would be able to give you a clearer bug report. However this did not help.
When I go into the project directory (where the sln file is) and I run the following command:
mvn -e clean sonar:sonar
I see that the maven sonar plugin does analysis, fetches settings from the local sonar instance, and generates the expected output files (target/sonar/stylecop-msbuild.xml for instance). However, these reports do not get uploaded to sonar, and I see the following error being reported by maven:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: org.sonar.plugins.core.sensors.ProjectLinksSensor has unsatisfied dependency: class org.apache.maven.project.MavenProject among unsatisfiable dependencies: [[class org.apache.maven.project.MavenProject]] where org.sonar.batch.bootstrap.ProjectModule#2c507f:135<I<org.sonar.batch.bootstrap.BatchModule#659812:139<I<org.picocontainer.DefaultPicoContainer#eb1882:44<| was the leaf container being asked for dependencies.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
Aside from the rather unhelpful error (ProjectModule#2c507f doesn't really tell me much), this looks like a nasty bug, which is causing the sonar upload (at least for me) to not work.
Did anybody else have this issue? What is causing this and why is the error reporting so terrible in this case?
Please note taht I've also reported this as a bug on Jira, because I really think the Sonar/C-Sharp plugin ecosystem is leaving me in the dark here. However, it was put into the "Wont't fix" state without additional information. The Jira bug is here: https://jira.codehaus.org/browse/SONARPLUGINS-1264
I don't know if this will solve your problem, but I noticed that you refer to the C drive in all of your <sonar.*.installDirectory> tags, except for <sonar.fxcop.installDirectory>.
Oh, and you could also try to disable the stylecop module since you've accidentally copy-pasted <sonar.gendarme.mode>skip</sonar.gendarme.mode> in front of that module...
I am one of the main developers of sonar for c#.
I did not seen your jira ticket before. I actually agree with Fabrice, you should have send a mail to the user mailing-list.
About your issue, my first guess is that there is an error with your pom.xml file.
If you use "mvn -e clean sonar:sonar", you need to declare in the pom.xml file the "maven-dotnet-plugin" plugin. The "clean" part will be performed by this plugin.
Also, the correct command line would rather be "mvn clean package sonar:sonar", there will not be any assembly to analyse.
For more information on the maven-dotnet-plugin you can check out the documentation on :
http://maven-dotnet-plugin.appspot.com
You will find a pom example here :
http://maven-dotnet-plugin.appspot.com/configuration.html
Hope it helps

Compilation Error: [No relevant source lines]

I'm getting this error when trying to view a page in my localhost. Web site worked before. The code files are not pre-compiled. I've cleaned asp.net temporary folders and gave full control permission to IIS_IUSRS account for wwwroot and Temporary ASP.NET Files folder but no change.
I also get Access Denied error while try to execute
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -i
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC2000: compiler initialization failed unexpectedly: 0x80070005
Source Error: [No relevant source lines]
Source File: vbc : Fatal Line: 0
Detailed Compiler Output:
c:\windows\system32\inetsrv> "C:\Windows\Microsoft.NET\Framework64\v3.5\vbc.exe" /t:library /utf8output /R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\assembly\GAC_64\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll" /R:"C:\Windows\assembly\GAC_64\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\assembly\GAC_64\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\edc6d145\6ccb6f45\assembly\dl3\5a446507\0042bc76_16cec701\Intelligencia.UrlRewriter.DLL" /R:"C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /out:"C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\edc6d145\6ccb6f45\App_SubCode_vb.8xqaf3z2.dll" /D:DEBUG=1 /debug+ /define:_MYTYPE=\"Web\" /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Specialized,System.Configuration,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls,System.Web.Configuration,System.Data,System.Data.OleDb,System.Globalization /warnaserror- /optionInfer+ "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\edc6d145\6ccb6f45\App_SubCode_vb.8xqaf3z2.0.vb" "C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\edc6d145\6ccb6f45\App_SubCode_vb.8xqaf3z2.1.vb"
Microsoft (R) Visual Basic Compiler version 9.0.30729.715
Copyright (c) Microsoft Corporation. All rights reserved.
vbc : Fatal error BC2000 : compiler initialization failed unexpectedly: 0x80070005
First, try setting "Enable 32-bit Applications" to True for your website application pool if you are running on x64 machine.
If first option doesn't help, Grant Full Accesses for NETWORK SERVICE and IIS_IUSRS group on C:\Windows\Temp\ and C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
This happened to me after repairing / upgrading my VS 2013 Express
I first tried adding "IIS_IUSRS" and "NETWORK SERVICE" with Modify to the following:
C:\Users\[username]\AppData\Local\Temp\Temporary ASP.NET Files
C:\local\path\to\NET_App
C:\Windows\Temp
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
Those did not work. But then I removed the optimizeCompilations="true" from the compilation tag under system.web and everything worked great.
<compilation debug="true" targetFramework="4.5.1" batch="false" optimizeCompilations="false" />
I got the same error when i add .ascx and use it in .aspx, but src path was wrong, add:
tagPrefix="uc" src="~/Signup**d**/UserControls/CreditCheck.ascx" tagName="CreditCheck"
My solution was to Grant Full Accesses for NETWORK SERVICE user and Modify Rights for the IIS_IUSERS to your ASP.NET root application folder.
The issue was caused by web.config transformation. It needs to create a temp file in the root application folder.
The line zero behaviour is generally caused by compiling with optimizations turned on (eg inlining). Try unchecking "Optimize code" under your project's Properties - Build tab. Then Source Error will show the offending code with line numbers.
I faced same issue.
My Symptom: it was working find on local but was failing on dev/stage.
Reason I found: There was an appvariable used in aspx.cs (as following) which was missing in web.config
public static String myKey = ConfigurationManager.AppSettings["myKey"].ToString();
Reason it took long for me to figure out issue was, i was not expecting this type of error message on line 0 (may be because my developer defined this variable as static so it was throwing line 0 error)
We converted our webapps to 64 bit quite some time ago and I still see this error jumping between old solutions. However, suddenly none of the standard good answers found on this thread worked.
Here is what ended up fixing my case. In Visual Studio 2019 in the project properties, on the application tab, where you choose the framework, there is an option to "Install other frameworks..." It will link you to here https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?cid=getdotnetsdk . I downloaded and reinstalled, by choosing the repair option, the .Net Framework 4.8.1 Developer Pack and all is well now.
The only possible explanation why mine went bad is a Windows Update, maybe.

Categories