-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some NuGet packages are not recognized and not referenced #396
Comments
Hey Uwe, I am not sure what is happening, but I can definitely look at it. //css_include global-usings
//css_nuget SharpZipLib
typeof(ICSharpCode.SharpZipLib.Zip.FastZip).print(); Can you also give me the context - the .NET SDK version |
I've downloaded the latest source code of CS-Script and tried to debug it. Here are some random thoughts. When debugging through this section, the generated CSPROJ file, passed to <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>_59ffa5d1_390c_4d8c_9aa1_4b9064de83c7</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Svg" Version="3.2.3" />
<PackageReference Include="morelinq" Version="*" />
<PackageReference Include="Newtonsoft.Json" Version="*" />
<PackageReference Include="NuGet.Versioning" Version="*" />
<PackageReference Include="QuickUploader.WebApiAccessor" Version="*" />
<PackageReference Include="RestSharp" Version="*" />
<PackageReference Include="SharpZipLib" Version="*" />
<PackageReference Include="ZetaDeployer.RuntimeUploader" Version="*" />
<PackageReference Include="ZetaShortPaths" Version="*" />
<PackageReference Include="Microsoft.SqlServer.Compact" Version="*" />
</ItemGroup>
</Project> The CSPROJ looks correct to me (the file references to my script files are still missing, but I do think this is OK). After running the
Therefore, this call (which contains a bug, IMO) returns an empty Later on, it generates the final CSPROJ file to send to the compiler: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>do-build-all</AssemblyName>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>TRACE;NETCORE;CS_SCRIPT</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Threading.dll">
<HintPath>C:\Users\ukeim\.nuget\packages\System.Threading\4.0.11\lib\netcore50\System.Threading.dll</HintPath>
</Reference>
<Reference Include="Aspose.Cells.dll">
<HintPath>C:\P\zp-17.0\ZetaProducerContent\Development\Projects\Build\Helper\Aspose.Cells.dll</HintPath>
</Reference>
<Reference Include="System.Linq.dll">
<HintPath>C:\Users\ukeim\.nuget\packages\System.Linq\4.1.0\lib\netcore50\System.Linq.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json.dll">
<HintPath>C:\Users\ukeim\.nuget\packages\newtonsoft.json\9.0.1\lib\netstandard1.0\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="MoreLinq.dll">
<HintPath>C:\Users\ukeim\.nuget\packages\morelinq\4.3.0\lib\netstandard2.1\MoreLinq.dll</HintPath>
</Reference>
<Reference Include="Svg.dll">
<HintPath>C:\Users\ukeim\.nuget\packages\svg\3.2.3\lib\netcoreapp3.0\Svg.dll</HintPath>
</Reference>
<Reference Include="NuGet.Versioning.dll">
<HintPath>C:\Users\ukeim\.nuget\packages\nuget.versioning\6.9.1\lib\netstandard2.0\NuGet.Versioning.dll</HintPath>
</Reference>
<Reference Include="cscs.dll">
<HintPath>C:\Ablage\cs-script-master\src\cscs\bin\Debug\net8.0\cscs.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="C:\P\zp-17.0\ZetaProducerContent\Development\Projects\Build\do-build-all.cs" Link="do-build-all.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\Afx.cs" Link="Afx.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\AppOfflineUtilities.cs" Link="AppOfflineUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\BuildUtilities.cs" Link="BuildUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\CompilationUtilities.cs" Link="CompilationUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\FileSyncUtilities.cs" Link="FileSyncUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\FileUtilities.cs" Link="FileUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\FolderUtilities.cs" Link="FolderUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\FolderXCopy.cs" Link="FolderXCopy.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\FolderXCopyUtilities.cs" Link="FolderXCopyUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\FolderZip.cs" Link="FolderZip.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\Logging.cs" Link="Logging.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\ProcessUtilities.cs" Link="ProcessUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\QuickUploaderUtilities.cs" Link="QuickUploaderUtilities.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\SpecialFolders.cs" Link="SpecialFolders.cs" />
<Compile Include="C:\P\zp-17.0\_References\Submodules\zeta-shared-ci-assets\DevelopmentTools\CentralScripts\StringUtilities.cs" Link="StringUtilities.cs" />
<Compile Include="C:\P\zp-17.0\ZetaProducerContent\Development\Projects\Build\Helper\ExcelImport.cs" Link="ExcelImport.cs" />
<Compile Include="C:\P\zp-17.0\ZetaProducerContent\Development\Projects\Build\Helper\FileHelper.cs" Link="FileHelper.cs" />
<Compile Include="C:\P\zp-17.0\ZetaProducerContent\Development\Projects\Build\Helper\ModelHelper.cs" Link="ModelHelper.cs" />
<Compile Include="C:\P\zp-17.0\ZetaProducerContent\Development\Projects\Build\Helper\ProjektvorlageModel.cs" Link="ProjektvorlageModel.cs" />
<Compile Include="C:\P\zp-17.0\ZetaProducerContent\Development\Projects\Build\Helper\ProjektvorlageProcessor.cs" Link="ProjektvorlageProcessor.cs" />
<Compile Include="C:\P\zp-17.0\ZetaProducerContent\Development\Projects\Build\Helper\TagsController.cs" Link="TagsController.cs" />
<Compile Include="C:\Users\ukeim\AppData\Local\Temp\csscript.core\cache\475058790\do-build-all.attr.g.cs" Link="do-build-all.attr.g.cs" />
</ItemGroup>
</Project> Here, to my surprise, the initial (correct) |
I will have a look and compare the packages folder structure.
D:\dev\support>css -config:set:LegacyNugetSupport=false
set: LegacyNugetSupport: False
D:\dev\support>css test
Restoring packages...
Mapping packages to assemblies...
{ICSharpCode.SharpZipLib.Zip.FastZip}
.Assembly = {ICSharpCode.SharpZipLib, Version=1.4.2.13, Culture=neutral, PublicKeyToken=1b03e6acf1164f73}
.AssemblyQualifiedName = "ICSharpCode.SharpZipLib.Zip.FastZip, ICSharpCode.SharpZipLib, Version=1.4.2.13, Culture=neutral, PublicKeyToken=1b03e6acf1164f73"
.Attributes = Public, BeforeFieldInit
.BaseType = {object}
.ContainsGenericParameters = False
. . . Will let you know the folder structure comparison outcome. |
Thanks, @oleg-shilo. In the final CSPROJ that gets sent to the Do I have an option to skip the whole "self-made" lookup mechanism and simply have all (correctly!) detected |
I'm having the following .NET SDKs on my machine:
I could also assemble a test script if it would help you. Personally, I do think that is something that happend on my machine that suddenly breaks the scripts; I just don't know what. |
To my surprise, this compiles successfully on my machine 😢. |
OK, I do think I figured it out: My script also included another file //css_nuget -force:3600 -ver:3.2.3 -ng:"-Source https://nuget.org/api/v2/" Svg
//css_nuget -force:3600 -ng:"-Source https://nuget.org/api/v2/" Microsoft.SqlServer.Compact This was a fragment from when I used the old CS-Script that runs with .NET Framework. After changing it to this: //css_nuget Svg
//css_nuget Microsoft.SqlServer.Compact My script compiles successfully. I still don't know why the "old" NuGet reference syntax causes this behavior, but at least I do have an explanation and a fix now. Sorry for bothering you with my problems that I caused by myself. I leave this here to publicly shame myself and to maybe help someone in the future (possibly including myself). |
Not at all. This is a struggle that everyone would have to go through given the circumstances. I know I have been there once or twice. Likely your old I think it makes sense to update the project generation output to help with the troubleshooting. Currently, this is what it does: But it should include the nuget packages requested. Also something similar might be printed in the output when the packages are being resolved. Currently it simply says "Resolving packages..." I am changing this issue to the "Enhancement". |
This is a great enhancement, Oleg. Thank you very much 😊 |
I do think I found a way to still generate the error: As soon as I do a
When removing the Only rebooting my whole PC helps resolving this. |
Uwe, what nuget support mode were you using in your last experiment? I just fixed it and repeated your test and it was able to detect the absence and recover even without restarting the script. The same experiment but for the legacy algorithm worked for me as well. BTW, in the new release, the new NuGet support algorithm is going to be enabled by default. |
Thanks, Oleg! The I'm so happy for all your support and this wonderful tool ❤️ |
All good. Meaning that it was a valid reason for the failure. BTW your report was again just in time. I am ready to release (on Sat) with the change you are waiting for. That support for NuGet native assets |
Great, it makes sense then.
I am also happy with the project having such a strong user base and devoted supporters like yourself. |
### CLI - #396 Some NuGet packages are not recognized and not referenced - #397: How to succeed in using NuGet packages with native binaries (like e.g. SkiaSharp) - Added new command `-list` for printing all currently running scripts. - Added support for nuget package native assets - LegacyNugetSupport by defauls made false - script compilation cache now stores probing dirs to allow recreation of PATH environemnt variable during the cached execution (e.g. to cover nuget native assets) - Added support for `-self-install` command to set global `CSSCRIPT_ROOT` envar. - Updated `//css_nuget` syntax CLI documentation ### CSScriptLib - no changes
Suddenly, out of nowhere, I get errors because it seems CS-Script does not recognize all referenced NuGet packages anymore.
My script worked well before.
I tried this directly on the command line:
Then, the beginning output of the last command is:
It starts promising, as it correctly detects "sharpziplib".
The output continues:
As you can see, the detected references do not include "sharpziplib" despite having
//css_nuget SharpZipLib
in my "do-build-all.cs" script.The output then continues:
This did work before and now suddenly does not work.
I'm rather clueless and I thought this happened before but found no issue here so far to see what helped back then.
To add more information, my "C:\Users\ukeim.nuget\packages\sharpziplib" folder contains this structure:
My question:
Do you have any idea what might go on or what might have happened?
The text was updated successfully, but these errors were encountered: