Rank: Advanced Member
Groups: Registered
Joined: 3/21/2019(UTC) Posts: 41 Location: Austria
Thanks: 30 times Was thanked: 7 time(s) in 7 post(s)
|
edfrey;14323 wrote:Good morning! We have a large number of c# projects and have been upgrading frameworks very quickly and it was very human error prone so we broke the target framework out into a property in our Directory.Build.props. I added the Directory.Build.props file to the ncrunch config to copy over as a needed file but still ncrunch gives me an error about unknown framework. For now I've explicitly defined the framework as a custom build property on every project but I'd like to remove that if possible. This appears to only be an issue with building in ncrunch as the rest of our build / deployment pipeline works. Does anyone have any ideas how to resolve this issue? Ncrunch 4.2, optimized engine. Thank you! Quote:ENGINE - [10:21:51.4127-InitialisationQueueTask-76] ERROR (Load): Error occurred during load of component at UnitTests.csproj: System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file: The "ResolvePackageAssets" task failed unexpectedly. NuGet.Frameworks.FrameworkException: Invalid framework identifier ''. at NuGet.Frameworks.NuGetFramework.GetShortFolderName(IFrameworkNameProvider mappings) at Microsoft.NET.Build.Tasks.LockFileExtensions.GetTargetAndThrowIfNotFound(LockFile lockFile, NuGetFramework framework, String runtime) at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task) at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash) at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task) at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() at Microsoft.NET.Build.Tasks.TaskBase.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() at nCrunch.Compiler.ComponentAnalysisContext.() at nCrunch.Compiler.ComponentAnalysisContext.AnalyseComponentBuild() at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.(CallMethodMessage ) at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data) at nCrunch.TaskRunner.Ipc.RemoteInstance.(Byte[] ) at nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters) at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner ) at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , FilePath , String , ExternalProcess ) at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , EffectiveProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridAddress ) at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables) at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(EffectiveProcessorArchitecture , String ) at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFramework)
From csproj: Quote: <PropertyGroup> <TargetFramework>$(AppFrameworkVersion)</TargetFramework> </PropertyGroup>
From Directory.Build.props Quote:<Project> <PropertyGroup> <AppFrameworkVersion>netcoreapp3.1</AppFrameworkVersion> <LibraryFrameworkVersion>netstandard2.1</LibraryFrameworkVersion> </PropertyGroup> </Project> works if I override ncrunch with this Quote:<ProjectConfiguration> <Settings> <CustomBuildProperties> <Value>TargetFramework = netcoreapp3.1</Value> </CustomBuildProperties> </Settings> </ProjectConfiguration> Starting with VS 16.4 you no longer need to specifiy the target framework for each project --> therefore you can remove it from every csproj file an add it to the directory.build.props file (I have done this with my solutions and it works with R# Build, VS Build and also with NCrunch (without any extra effort). e.q: Directory.Build.props: <Project> <PropertyGroup> <AppFrameworkVersion>netcoreapp3.1</AppFrameworkVersion> <LibraryFrameworkVersion>netstandard2.1</LibraryFrameworkVersion> <TargetFramework>$(AppFrameworkVersion)</TargetFramework> // I don't know if you can use the variable $(AppFrameworkVersion) here, but you could replace it with netcoreapp3.1 (the only drawback when the variable does not work is that you have the string netcoreapp3.1 added twice, but I think that's not too bad. </PropertyGroup> </Project>
|