do you know if is available some guide how to run a project created from the sample starter project from sources? I suppose that cloning the repositories from github and configuring the solution may be possible to do this, may be very useful to study how it works.
thanks,
Luca
this is the outuput of the kvm list command
------ ------- ------- ------------ -------- -----
1.0.0-beta1 CLR amd64 C:\Users\luca\.kre\packages
1.0.0-beta1 CLR x86 C:\Users\luca\.kre\packages
1.0.0-beta1 CoreCLR amd64 C:\Users\luca\.kre\packages
1.0.0-beta1 CoreCLR x86 C:\Users\luca\.kre\packages
1.0.0-beta2-10724 CLR x86 C:\Users\luca\.kre\packages
1.0.0-beta2-10724 CoreCLR x86 C:\Users\luca\.kre\packages
1.0.0-beta2-10726 CLR x86 C:\Users\luca\.kre\packages
1.0.0-rc1-10781 CLR x86 C:\Users\luca\.kre\packages
1.0.0-rc1-10781 CoreCLR x86 C:\Users\luca\.kre\packages
1.0.0-rc1-10798 CLR x86 C:\Users\luca\.kre\packages
1.0.0-rc1-10798 CoreCLR x86 C:\Users\luca\.kre\packages * 1.0.0-rc1-10804 CLR x86
C:\Users\luca.kre\packages default
I cloned and added those repositories:
Configuration,DataCommon,Data Protection,Dependency Injection,Diagnostic,Entity Framework, File System, Hosting, HttpAbstraction,Identity, KRuntime, Logging, Mvc, Razor, Routing, Scaffolding, Security, Static Files, WebSockets Abstractions.
Seems to me those are the needed repositories need to run it from local sources.
other errors:
6>D:\Studio\vs2015\FromSource\KRuntimeSrc\Microsoft.Framework.Runtime.Roslyn\RoslynCompiler.cs(10,25): ASP.NET 5.0 error CS0234: The type or namespace name 'PortableExecutable' does not exist in the namespace 'System.Reflection' (are you missing an assembly reference?)
6>D:\Studio\vs2015\FromSource\KRuntimeSrc\Microsoft.Framework.Runtime.Roslyn\AssemblyNeutral\EmbeddedReferencesHelper.cs(5,25): ASP.NET 5.0 error CS0234: The type or namespace name 'Metadata' does not exist in the namespace 'System.Reflection' (are you missing an assembly reference?)
6>D:\Studio\vs2015\FromSource\KRuntimeSrc\Microsoft.Framework.Runtime.Roslyn\AssemblyNeutral\EmbeddedReferencesHelper.cs(6,25): ASP.NET 5.0 error CS0234: The type or namespace name 'PortableExecutable' does not exist in the namespace 'System.Reflection' (are you missing an assembly reference?)
6>D:\Studio\vs2015\FromSource\KRuntimeSrc\Microsoft.Framework.Runtime.Roslyn\AssemblyNeutral\TypeCompilationContext.cs(57,47): ASP.NET 5.0 error CS0012: The type 'ImmutableArray<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections.Immutable, Version=1.1.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
6>D:\Studio\vs2015\FromSource\KRuntimeSrc\Microsoft.Framework.Runtime.Roslyn\AssemblyNeutral\TypeCompilationContext.cs(57,36): ASP.NET 5.0 error CS1579: foreach statement cannot operate on variables of type 'System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.INamedTypeSymbol>' because 'System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.INamedTypeSymbol>' does not contain a public definition for 'GetEnumerator'
6>D:\Studio\vs2015\FromSource\KRuntimeSrc\Microsoft.Framework.Runtime.Roslyn\AssemblyNeutral\TypeCompilationContext.cs(62,38): ASP.NET 5.0 error CS0012: The type 'ImmutableArray<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections.Immutable, Version=1.1.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Install VS 2015
Clone the repos that you want to build
If you want to build the dev branch, make sure you install the dev KRE (https://github.com/aspnet/home/tree/dev)
Open the solution in VS and build
If you want to include the source of one of the dependencies, you can:
clone the repo locally with git (eg. git clone http://github.com/aspnet/Mvc for the MVC 6 repository)
execute kpm restore in the repos local folder
then reference the source in your solution's global.json. Add the "sources" attributes as follows:
global.json
{
"sources": [ "src", "test", "/path/to/your/project/src" ]
}
You might also need to tweak the dependencies in your project.json for the projects where you want to use the source:
"Microsoft.AspNet.Mvc": "6.0.0-beta1"
try changing it to
"Microsoft.AspNet.Mvc": ""
Another thing to try is to use kpm restore in your project folder. The K Package Manager should go and get any of the dependencies listed in your project.json file, but in practice, I found that it doesn't always find the specific versions I'm looking for.
Related
I am trying to compile this Json.NET code:
using Newtonsoft.Json;
...
MyDesc d = JsonConvert.DeserializeObject<MyDesc>(jsonInput);
...
with this command via mono (on ubuntu):
$ mcs Main.cs -lib:/home/username/JsonNET/Net40/Newtonsoft.Json.dll
But i am getting "no assembly reference"-error:
error CS0246: The type or namespace name `Newtonsoft' could not be found.
Are you missing an assembly reference
What is the correct Json.NET Mono assebmly reference?
(-lib option looks right for this, but it does not work -lib:PATH1[,PATHn] Specifies the location of referenced assemblies )
The mono compiler command to reference other assemblies is -r:PATH/TO/ASSEMBLY. You should try this with the current version of mono.
$ mcs Main.cs -r:/home/username/JsonNET/Net40/Newtonsoft.Json.dll
Reference: http://linux.die.net/man/1/mcs or type into your shell:
$ man mcs
I input this command
gmcs -t:library Program.cs
and get this error
Program.cs(6,14): error CS0234: The type or namespace name `Tasks' does not exist in the namespace `System.Threading'. Are you missing an assembly reference?
I get I have to give it the paths and everything, but how? can't find the way to do it
gmcs targets the .NET 2.0 profile, Task didn't exist back then.
On a recent Mono just use mcs, as gmcs is deprecated and was removed from Mono 4.0.
Following from How can I build a targetting pack for Portable Class Libraries? and the advice in http://jpobst.blogspot.com/2012/04/mono-for-android-portable-libraries-in.html I've managed to build some monodroid example programs which use Portable Class Libraries.
However, if any of my input PCLs reference the System.Net assembly, then monodroid fails to package my apk - because it complains about File Not Found for System.Net.dll.
As I understand it (from http://docs.xamarin.com/android/about/assemblies), MonoDroid bundles all the System.Net functionality inside System.dll.
Is there any way I can get MonoDroid to use these PCLs which reference System.Net?
Is there any way I can get the monodroid packager to understand this System.net-> System redirection?
Or is there some pre-package step I could run that would "correct" the referencing just for monodroid?
Or any other suggestions?
Update with technical info:
The packaging process is currently failing at the level of:
"C:\Projects\Misc\MVVMCROSS\Sample - Tutorial\Tutorial\Tutorial.UI.Droid\Tutorial.UI.Droid.csproj" (SignAndroidPackage target) (1) ->
(_ResolveAssemblies target) ->
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(441,2): error : Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. Perhaps it doesn't exist in the Mono for Android profile? [C:\Projects\Misc\MVVMCROSS\Sample - Tutorial\Tutorial\Tutorial.UI.Droid\Tutorial.UI.Droid.csproj]
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(441,2): error : File name: 'System.Net.dll' [C:\Projects\Misc\MVVMCROSS\Sample - Tutorial\Tutorial\Tutorial.UI.Droid\Tutorial.UI.Droid.csproj]
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(441,2): error : at Monodroid.Tuner.MonoDroidResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) [C:\Projects\Misc\MVVMCROSS\Sample - Tutorial\Tutorial\Tutorial.UI.Droid\Tutorial.UI.Droid.csproj]
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(441,2): error : at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly) [C:\Projects\Misc\MVVMCROSS\Sample - Tutorial\Tutorial\Tutorial.UI.Droid\Tutorial.UI.Droid.csproj]
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(441,2): error : at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly) [C:\Projects\Misc\MVVMCROSS\Sample - Tutorial\Tutorial\Tutorial.UI.Droid\Tutorial.UI.Droid.csproj]
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(441,2): error : at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List`1 assemblies, AssemblyDefinition assembly) [C:\Projects\Misc\MVVMCROSS\Sample - Tutorial\Tutorial\Tutorial.UI.Droid\Tutorial.UI.Droid.csproj]
C:\Program Files (x86)\MSBuild\Novell\Novell.MonoDroid.Common.targets(441,2): error : at Xamarin.Android.Tasks.ResolveAssemblies.Execute() [C:\Projects\Misc\MVVMCROSS\Sample - Tutorial\Tutorial\Tutorial.UI.Droid\Tutorial.UI.Droid.csproj]
This is occurring within the MSBuild task:
<!-- Find all the assemblies this app requires -->
<ResolveAssemblies
Assemblies="$(ProjectDir)$(OutDir)$(TargetFileName);#(ReferencePath)"
I18nAssemblies="$(MandroidI18n)"
LinkMode="$(AndroidLinkMode)"
ReferenceAssembliesDirectory="$(TargetFrameworkDirectory)">
<Output TaskParameter="ResolvedAssemblies" ItemName="ResolvedAssemblies" />
<Output TaskParameter="ResolvedUserAssemblies" ItemName="ResolvedUserAssemblies" />
<Output TaskParameter="ResolvedFrameworkAssemblies" ItemName="ResolvedFrameworkAssemblies" />
<Output TaskParameter="ResolvedSymbols" ItemName="ResolvedSymbols" />
</ResolveAssemblies>
imported from:
<UsingTask TaskName="Xamarin.Android.Tasks.ResolveAssemblies" AssemblyFile="Novell.MonoDroid.Build.Tasks.dll" />
A possible solution (assuming MonoDroid supports type forwarding) is to have a System.Net.dll assembly which type forwards the relevant types to System.dll.
In the full .NET Framework, I believe those System.Net types are in System.dll, and if you look in System.Net.dll on .NET 4.0.3 or 4.5, you will see TypeForwardedToAttributes for those types, which allow those type references to System.Net.dll in a portable library to be redirected to System.dll. Jeremy Likness's blog post series on Understanding Portable Libraries goes into some detail about how this all works.
The references in a portable library refer to the full strong name of System.Net.dll. So you couldn't produce a correctly signed assembly with those type forwards yourself, since you don't have the private key. However, MonoDroid may handle strong names or signature validation differently. So you might be able to produce a System.Net.dll with the type forwards that MonoDroid would accept, and package it with your MonoDroid application.
I'm trying to run msbuild in Jenkins.
When it reaches the UniTest-Project an error occures:
Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.sln" (1) is building "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.unitTests\***.unitTests.csproj" (4) on node 0 (default targets).
Project file contains ToolsVersion="4.0", which is not supported by this version of MSBuild. Treating the project as if it had ToolsVersion="3.5".
ResolveAssemblyReferences:
Primary reference "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL".
Could not find dependent files. Could not load file or assembly 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
For SearchPath "{Registry:Software\Microsoft\.NetFramework,v4.0,AssemblyFoldersEx}".
Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VSTSDB\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\2.0\Runtime\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\MySQL\MySQL Connector Net 6.3.6\Assemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft.NET\Primary Interop Assemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll", but it didn't exist.
Considered "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.exe", but it didn't exist.
CalculatorServiceTest.cs(1,17): error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
CalculatorServiceTest.cs(11,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(11,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(24,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(24,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(37,10): error CS0246: The type or namespace name 'TestMethod' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(37,10): error CS0246: The type or namespace name 'TestMethodAttribute' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(6,6): error CS0246: The type or namespace name 'TestClass' could not be found (are you missing a using directive or an assembly reference?)
CalculatorServiceTest.cs(6,6): error CS0246: The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?)
Done Building Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.unitTests\***.unitTests.csproj" (default targets) -- FAILED.
Done Building Project "C:\Program Files (x86)\Jenkins\jobs\***\workspace\***.sln" (default targets) -- FAILED.
Build FAILED.
Any suggestions what the problem could be? Running ms build from the command works for the solution and without any additional parameters when the project was compiles in VS bevor. After a clean solution the same errors occur. Must be some parameter or reference problem; Line two talks bout v4 and v3.5 problems; but i can't figure out how to solve this.
Greets
Error info directly shows that you use incorrect version of MSBuild
This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
Try to rebuild with MSBuild 4.0
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe *.sln /t:rebuild
OR/AND from VS2010 Command Line.
I had a similar problem which seemed to be caused by running Jenkins as a service under the SYSTEM account. Somehow cmd.exe was not referencing all the necessary environment variables to be able to find my NUnit assemblies.
If you're running Jenkins as a service, try setting it to run as your user account and see if that helps.
Im building from the default windows cmd using:
C:...\MSBuild.exe *.sln
The solution-projects are all 3.5; only the Unit-Test Project is 4.0 (as you can't change this)
I just mentioned, that building it that way works, when i build it first with VS and don't deleted (clean solution) the binaries. Never mind.
How do i have to use msbuild from cmd to build a *.sln including unittests?
Can anyone shed any light on how the CoreCompile task in TFS2010 (RC) Microsoft.TeamFoundation.Build targets generates the assembly references that are passed to csc.exe?
We are seeing references to both version 2.0 and 4.0 of System.Xml.dll (shown in bold below), however we are using the 'Specific Version: true' flag on the project assembly reference and there are no references to the 4.0 assembly in the btproj file:
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /platform:x86 /errorreport:prompt /warn:4 /define:TRACE
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll
**/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll**
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.dll
**/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Xml.dll**
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Data.dll
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Web.Services.dll
Update: I've checked the output of the ResolveAssemblyReferences target (from Microsoft.Common.targets) and can see that only the assemblies referenced in the project (i.e. the 2.0 framework assemblies) are included in the item list '_ResolveAssemblyReferenceResolvedFiles':
ResolveAssemblyReferenceResolvedFiles:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Configuration.dll;
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll;
C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll
However, the CoreCompile target still includes the 4.0 assemblies as detailed above.
Update 2: Ok, I've tracked this down to an obscure bug in the AddBizTalkHiddenReferences target in the BizTalk build scripts. This particular target attempts to add additional assemblies, including the ones that are duplicated above.
However, it uses the GetCORSystemDirectory from 'mscoree.dll' which returns the installation directory of the common language runtime (CLR) that is loaded into the process, in this case the 4.0 framework loaded into MSBuild; as a result, the helper doesn't think it has the System.Xml assembly referenced and adds it, hence the duplicate.
Reference assemblies are resolved by ResolveAssemblyReferences target in the file Windows\Microsoft.NET\Framework\$(Version)\Microsoft.Common.targets based on the Reference items defined in your project file.