Due to some custom reasons, we have some custom built-in features in the XF (like the XAML-based toolbar button and changing private-internal to the public classes, plus virtualizing some methods). As the result, we are dependent on the custom version of the XF NuGet package.
It worked (almost always) perfectly until the version XF5.0. I have a dedicated virtual machine with Windows and preinstalled VS for those purposes.
When I'm trying to build XF from sources using the next command
.\build.ps1 -Target NugetPack -ScriptArgs '--packageVersion="5.0.0.2013"'
I get the error:
Successfully created package 'L:\src_github\xf_patch_release-5.0.0-sr3.1\artifacts\Xamarin.Forms.Maps.WPF.5.0.0.2013.nupkg'.
NuGet Version: 5.9.1.11
Attempting to build package from 'Xamarin.Forms.temp.nuspec'.
Object reference is not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.Packaging.PackageBuilder.<>c.<ValidateReferenceAssemblies>b__173_1(NuGet.Frameworks1204671.NuGetFramework groupFramework)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
at NuGet.Packaging.PackageBuilder.ValidateReferenceAssemblies(IEnumerable`1 files, IEnumerable`1 packageAssemblyReferences)
at NuGet.Packaging.PackageBuilder.Save(Stream stream)
at NuGet.Commands.PackCommandRunner.BuildPackage(PackageBuilder builder, String outputPath, Boolean symbolsPackage)
at NuGet.Commands.PackCommandRunner.BuildFromNuspec(String path)
at NuGet.CommandLine.PackCommand.ExecuteCommand()
at NuGet.CommandLine.Command.ExecuteCommandAsync()
at NuGet.CommandLine.Command.Execute()
at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
An error occurred when executing task '_NuGetPack'.
Error: One or more errors occurred. (NuGet: Process returned an error (exit code 1).)
NuGet: Process returned an error (exit code 1).
I've tried to use different methods to get rid of this non-understandable issue, but nothing happened. I've tried to use the latest actual release-5.0.0-sr3.1 tag and the latest version of the branch 5.0.0
I've tried to change some settings in the build.cake file, to unload some projects from the solution (like UWP-related ones, which usually caused a lot of errors). I've tried to build the solution on my working computer (and environment) - I got the same result.
Then I switched to building the solution in the VS directly and started getting issues like:
Before calling the main task to build: .\build.ps1 -Target NugetPack... I always call the .\build.ps1 -Target provision to ensure that I haven't missed some required tools on each Windows OS.
Is there something that I have missed?
I've found out that I'm using a different version of the NuGet package manager, which I had to install globally on my OS. The right version can be found in the XF's Pipelines (https://dev.azure.com/xamarin/public/_build, see the Windows-related builds).
After I've changed the global version to 5.6.0, the build script started generating the *.nupkg file for the Xamarin.Forms project itself correctly.
...
Related
When I try to run my program in release mode, it give this error:
Severity Code Description Project File Line Suppression State
Error XAGJS7004 System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Xamarin.Android.Tasks.TypeMapGenerator.GenerateRelease(Boolean skipJniAddNativeMethodRegistrationAttributeScan, List`1 javaTypes, String outputDirectory, ApplicationConfigTaskState appConfState)
at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings(List`1 types, TypeDefinitionCache cache)
at Xamarin.Android.Tasks.GenerateJavaStubs.Run(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 MauiApp1 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.440\tools\Xamarin.Android.Common.targets 1438
It is strange because in debug mode it works fine and I can't find any answer online.
Window snippet
There is fore sure some incompatibility between MAUI and .NET7, but you can set your project to use previous NET6 version following few steps:
Discover installed SDKs and keep note of the exact version 6
dotnet --info
SDKs list
Move to project folder and create a global.json file, it sets the NET SDK to be used. Be sure to set the installed SDK version:
dotnet new globaljson --sdk-version 6.0.301 --roll-forward disable
Restore workloads required by your project:
dotnet workload restore
Open project in Visual Studio, confirm to reload the project if requred.
Now your project will be built using NET6 SDK.
I solved it by uninstalling .net7, I found on Maui's github page people with the same problem and I think it will be fixed in the future.
It remains a shame Maui is not yet ready for .net7
Had the same problem, working on debug, this exception on release.
I solved it by: Clean Maui solution -> delete bin and obj -> Close Visual Studio -> Rebuild -> Working
Hope this helps if you didn't try
Really struggling with an issue publishing a Blazor WASM project that is using .NET 6.
Previously, it was on .NET 5, and there were no issues with building / publishing the app.
I've updated it to .NET 6, by essentially updating the nuget references for:
Microsoft.AspNetCore.Components.WebAssembly (to 6.0.0-rc.2.21480.10)
Microsoft.AspNetCore.Components.WebAssembly.DevServer (to 6.0.0-rc.2.21480.10)
We've updated to .NET 6 due to a requirement on DynamicComponent
Running locally during development is fine.
During our build pipeline, I am executing the following to publish the app:
dotnet publish .\Web\Web.Connect --configuration debug --output output
The output that I am getting is:
Web.Connect -> C:\git\core\Web\Web.Connect\bin\debug\net6.0\Web.Connect.dll
Web.Connect (Blazor output) -> C:\git\core\Web\Web.Connect\bin\debug\net6.0\wwwroot
Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : System.ArgumentException: An item with the same key has already been added. Key: C:\git\core\Web\Web.Connect\obj\debug\net6.0\build-gz\bxkpRzBw.gz [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : at Microsoft.NET.Sdk.BlazorWebAssembly.ComputeBlazorPublishAssets.GroupExistingStaticWebAssets(Dictionary`2 assemblyAssets, Dictionary`2 nativeAssets, Dictionary`2 satelliteAssemblyAssets, Dictionary`2 symbolAssets, Dictionary`2 compressedRepresentations) [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\targets\Microsoft.NET.Sdk.BlazorWebAssembly.6_0.targets(404,5): error : at Microsoft.NET.Sdk.BlazorWebAssembly.ComputeBlazorPublishAssets.Execute() [C:\git\core\Web\Web.Connect\Web.Connect.csproj]
Ok - so some asset is trying to be published multiple times in ComputeBlazorPublishAssets?
Found information indicating that adding <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> to the *.csproj might help here, but it has made no difference.
I have ensured that the wasm-tools have been installed via dotnet workload install wasm-tools.
Running a "Publish" via VS 2022 also gives the same error.
I am at a loss as to how I can debug this, or figure out what is getting generated twice, or how to fix this issue.
Thanks.
Ok,
After a significant amount of investigation looking at the binlog files, I have managed to track this down to the fact that my referenced library (which is a netstandard 2.0 project shared with other projects in the solution) was also outputting an app.config file (possibly due to an earlier time when we targeted both netstandard2.0 and net472).
Looking at the MSBuild bin logs:
So, there were two compressed files with the same name - one was referencing the actual *.dll, but the other was referencing *.dll.config
I deleted the app.config (it wasn't really needed and was probably there due to some historic reason) and it's now publishing as expected.
In trying to build NuGet3, I'm getting the following error:
~/Projects/NuGet3-dev/src/NuGet.CommandLine/project.json(22,46): error: The dependency fx/Microsoft.Build.Framework >= 14.0.0 could not be resolved.
I have no idea why it wouldn't be resolved, since according to
gacutil -l
I have it:
Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
I looked at everything I could find about this issue, but it's almost entirely Visual Studio and Windows based resolutions, and nothing seems to apply to my situation...
How to make this resolve?
(Assuming you are working on https://github.com/NuGet/NuGet.CommandLine ...)
How to resolve?
Use Windows. This project is not designed to be built on Mono. It is integrated with Windows tooling.
Under POSIX systems (thought, some true operating system):
In short, the dependency is resolved using DNX or dotnet (said M$ .Net Core), and its restore command.
The fx/ stands for framework, just drop the prefix, it should be the same. I sow these kind of notations disappear, when passing to DNX. Just try and install it using the DNX process.
since MSBuild targets and props for DNX are not available, the xbuild script from Mono won't work.
You'll have to use one of
the "deprecated" dnvm.sh script and dnx/dnu commands to restore and then build each sub project.
Note: that yet isn't anymore available at download, and the call to dnvm update-self relaces the script by a "404" ...
The "Microsoft .NET Core Shared Framework Host", "dotnet" (that I don't use)
It should mostly work, if you've got Dnx, try this command line, from the src sub-dir of the NuGet3 source code:
(for d in *; do (cd $d && dnu restore && dnu build); done)2>&1|tee build-all.log
For me, using Debian-8, there are build failures:
NuGet.CommandLine.XPlat
NuGet.Configuration, but it succeeds for the "net451" framework
NuGet.Packaging.Core
NuGet.Packaging
NuGet.Protocol.Core.v3, but it's OK #dnxcore50 (don't ask me why) ...
YANote: If code cannot be transformed anywhere but by M$, this is cannot be source code for me : I cannot not use it as a source. This is a secret code, a private code ... something to throw away, and that probably no one cares.
I developed a pretty straight forward SSIS package (in VS2005 w/ .Net Framework V 2.0.50727 SP2) that gets a list of users to email, starts a for-each loop container and then executes a script task to retrieve user specific data and email it out to the user. When I run it on my dev box everything works great and runs as it should. However when I deploy the package to our production server running (Microsoft SQL Server 2005 - 9.00.5000.00 (X64) Standard Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 2) ) the task fails.
The original error message is:
Executed as user: xxxxx. Microsoft (R) SQL Server Execute Package Utility Version 9.00.5000.00 for 64-bit Code: 0x00000009 Source: PackageName Description: The task cannot execute in 64-bit environment because the script is not pre-compiled. Please turn on the option to pre-compile the script in the task editor. End Error ... Error DTExec: The package execution returned DTSER_FAILURE (1).
After researching that extensively the interwebs suggested that I try:
running the package in 32bit by changing the execution property in the SQL job and by changing my RunIn64BitMode property from true to false
which fails because " Option "/X86" is not valid."
install the Microsoft Hotfix
which doesn't apply since I am already running on SP2
So after more research I find that I need to turn on "Please turn on the option to pre-compile the script in the task editor." SOURCE: ssis-dtsx DOT blogspot DOT com/2010/03/cannot-execute-in-64-bit-environment.html
Which entails:
Make sure that each script task has PreCompile = True
Open Script Task Editor, switch to Script tab and make sure that
PrecompileScriptIntoBinaryCode = True
Click on Design Script to open code editor (Visual Studio for Applications) and then choose it using File > Close and Return (VSA will recompile and store binary code in the package).
Build Project and copy to target location
However when I execute the package I immediately get the error:
Executed as user: xxxx. ...0.5000.00 for 64-bit Code: 0x00000008 Source: PackageName Description: The task is configured to pre-compile the script, but binary code is not found. Please visit the IDE in Script Task Editor by clicking Design Script button to cause binary code to be generated. End Error Code: 0x00000008 Source: GET PO infor and Email Description: Script could not be recompiled or run: Retrieving the COM class factory for component with CLSID...
So my final step was to turn DelayValidation property from False to True in the SSIS pkg, go into the design script to cause it to be rebuilt, then redeploy, and rerun and I still get the same error.
On searching the error I am directed to Microsoft HOT FIX which suggested that I download another hotfix.
I have not yet downloaded the hotfix, and would prefer not to if I can avoid it (our OPs team doesnt like running hotfixes mid day on production servers).
Go to the package, open the script component, then within Visual Studio (while looking at the code) click on BUILD. This will compile the package, if there are no issues preventing it from compiling. Then SAVE, go back and ensure that you click on "OKAY" and not "cancel", if you click on cancel then the whole thing reverts back.
Note: This section contains incorrect information - skip to the update below for details. This section left in for historical purposes.
I have a WPF project in Visual Studio 2008 targeting .NET 3.5 that references SharpSVN. When I make a call into SvnClient.Export, I get an exception that Marshal.GetExceptionCode tells me is 0xc06d007e. This seems to be caused by a bad DLL. I have tracked (with the Dependency Walker) that DLL to two culprits: IEFRAME.DLL and SHLWAPI.DLL. They are missing the following export functions:
SHLWAPI.DLL: #270
IEFRAME.DLL: #141, #159, #160
I also initially had a missing DLL that was fixed by adding %ProgramFiles%\Internet Explorer to the path. I do not recall the DLL name.
This is a fresh install of Visual Studio 2008, SharpSVN 1.7002.1998.12257.
I can run the "svn" command that is provided with SharpSVN to export from our repository, so I am leaning toward a solution/project configuration/reference problem.
How do I fix this error?
*Update: I have refined my understanding of this problem. The SHLWAPI and IEFRAME issues appear to be a normal condition - User32.dll has the same behavior. I modified my environment in the following ways:
Environment variable [SVN_SSH] set to TortoisePlink [C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe]
Updated uri target to use current username:
SvnUriTarget uriTarget =
new SvnUriTarget("svn+ssh://" + Environment.UserName + "#myserver/mypath");
With this configuration, I can successfully export when running this code as part of the WPF application. However, I still get errors when running as part of a MSTest project.
System.Runtime.InteropServices.SEHException: External component has thrown an exception.\r\n
at svn_client_export5(Int32* , SByte* , SByte* , svn_opt_revision_t* , svn_opt_revision_t* , Int32 , Int32 , Int32 , svn_depth_t , SByte* , svn_client_ctx_t* , apr_pool_t* )\r\n
at SharpSvn.SvnClient.Export(SvnTarget from, String toPath, SvnExportArgs args, SvnUpdateResult& result) in g:\\dist\\src\\sharpsvn\\commands\\export.cpp:line 100
at SharpSvn.SvnClient.Export(SvnTarget from, String toPath, SvnExportArgs args) in g:\\dist\\src\\sharpsvn\\commands\\export.cpp:line 66
at SimulationManager.Model.SubversionInterface.Export() in C:\\Users\\phines\\Documents\\Projects\\SimulationManager\\SimulationManager\\SimulationManager\\Model\\SubversionInterface.cs:line 43
I suspect this is due to a reliance on the presentation framework, but would still like to know if there is a way to get this working in a GUI-less way.
The errors with IEFrame and SHLWAPI are normal problems that depends reports as errors, but do not acutally cause the error. In my case, the error was caused by using SharpSVN in a non-user interface project. When moved to a WPF project, it worked as expected.
I have changed strategies to call a command shell "svn" application to achieve UI-less automation.