Skip to content
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

Cannot use reference #184

Closed
stef-pellegrino opened this issue Feb 11, 2021 · 10 comments
Closed

Cannot use reference #184

stef-pellegrino opened this issue Feb 11, 2021 · 10 comments
Milestone

Comments

@stef-pellegrino
Copy link

stef-pellegrino commented Feb 11, 2021

Steps to reproduce:

Create C# DLL within a folder TestDll

[DllExport]
public int test() {
  return 0;
}
  • Open VS2019 and Test solution
  • Put"DllExport.bat" in same directory than Test.sln
  • Double click on DllExport.bat
  • Select [Apply]
  • Focus on VS + reload all
    rebuild gives me :
    error CS0246: The type or namespace name 'DllExport' could not be found (are you missing a using directive or an assembly reference?)

Click on reference gives me "The proejct cannot be viewed in the object browser because it is not available or not yet build" !??

  • DllExport -version: 1.7.4
  • Used Visual Studio / MSBuild / VS 2019 (Windows 10)
@3F
Copy link
Owner

3F commented Feb 11, 2021

@stef-pellegrino Please copy everything from the Data tab for the selected project in which it was installed.

@zuoyi1025
Copy link

Same Problem here...has anyone any hint?

@3F
Copy link
Owner

3F commented Feb 26, 2021

@zuoyi1025
Please follow the issue template to provide a minimal case info. Log / demo projects are better in a quick inspections. But I didn't even see the requested info from the Data tab.

Note the build must be with diagnostic level. For msbuild, /v:diag or better /bl. Also note the /bl by default collects the source text of project files. See Doc. When configuring use the -debug key.

@3F 3F added the need info label Feb 26, 2021
@leculver
Copy link

Same problem. The issue seems to be that RichCodeNav.EnvVarDump is missing? Here's what the package manager output looks like when attempting to add the "DllExport" nuget package:

  GET https://api.nuget.org/v3-flatcontainer/richcodenav.envvardump/index.json
  NotFound https://api.nuget.org/v3-flatcontainer/richcodenav.envvardump/index.json 129ms
NU1101: Unable to find package RichCodeNav.EnvVarDump. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, nuget.org
Package restore failed. Rolling back package changes for 'TestPlugin'.
Time Elapsed: 00:00:00.4875334

@3F
Copy link
Owner

3F commented Apr 19, 2021

NU1101: Unable to find package RichCodeNav.EnvVarDump.

We do not use RichCodeNav.EnvVarDump. Some of the dependencies in your project requires this. You obviously need configuring package sources, for example via NuGet.config

Please also note we don't provide an official NuGet support for this tool
(if something is working, it's working, but for other case please use our official way. Briefly, just click this inside folder where .sln)

@T35R6braPwgDJKq
Copy link

Installed: True; 1.7.4+c1cc52f; invoked: 1.7.4
Project type: Cs
Storage: ProjectFiles
Compiler.Platform: Auto
Compiler.ordinalsBase: 1
Compiler.rSysObj: False
Compiler.ourILAsm: False
Compiler.customILAsm: 
Compiler.genExpLib: False
Compiler.peCheck: PeIl
Compiler.patches: None
PreProc.Type: None
PreProc.Cmd: 
PostProc.Type: None
PostProc.ProcEnv: $(SolutionPath);$(MSBuildThisFileFullPath)
PostProc.Cmd: 
SignAssembly: 
Identifier: FEDE8CF5-44B7-41A2-88A4-2D50ED26DE2C
Instance: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\amd64\MSBuild.exe
Project path: C:\Users\test\source\repos\testdll\testdll\testdll.csproj
Action: Configure
PlatformTarget: AnyCPU
TargetFramework: 
TargetFrameworks: 
TargetFrameworkVersion: v4.5
RootNamespace: testdll
AssemblyName: testdll
MgrArgs: 
MetaLib: tools\raw\lib\net20\DllExport.dll
MetaCor: tools\raw\lib\netstd\DllExport.dll
Proxy: 
StoragePath: .net.dllexport.targets
ddNS: testdll
ddNS max buffer: 500
UseCecil: True
intermediateFiles: False
timeout: 30000
Options: None
RootPath: C:\Users\test\source\repos\testdll\
PkgPath: C:\Users\test\source\repos\testdll\packages\\DllExport.1.7.4\
SlnFile: 
SlnDir: C:\Users\test\source\repos\testdll\
DxpTarget: tools\net.r_eg.DllExport.targets
MsgGuiLevel: -1
LockIfError: 

@3F
Copy link
Owner

3F commented Dec 17, 2021

@T35R6braPwgDJKq
Please attach at least the log when configuring and/or build log with diagnostic level to inspect the current problem.

C:\Users\test\source\repos\testdll\testdll\testdll.csproj

Attach everything if this is a really empty test project for better help to reproduce the problem locally.
Thanks.

@Miedziaq
Copy link

Miedziaq commented Dec 21, 2021

Hi in connecting to our other thread, I prepared some logs.
You should get it from wetransfer.com to ****@outlook.com

@3F
Copy link
Owner

3F commented Dec 21, 2021

I prepared some logs.

@Miedziaq There is no MSB3245: Could not resolve this reference as you mentioned in #196 (comment)

At least this is what I see in your build log.

There is single Error : Invalid Option: /PVP but this is absolutely another problem. Rather because of your mixed incorrect things in .csproj as I said earlier, for example, due to:

<TargetExt>.pvp</TargetExt>
<Target Name="PublishPVP" AfterTargets="RGieseckeDllExport" Condition="Exists($(PdfXEditorPluginDir))">
  <Message Text="=== Publish PVP ... ====================================================" />
  <CreateItem Include="$(OutputPath)$(AssemblyName)$(TargetExt)">
    <Output TaskParameter="Include" ItemName="PvpFilesToCopy" />
  </CreateItem>
  <!--<Copy SourceFiles="@(PvpFilesToCopy)" DestinationFolder="$(PdfXEditorPluginDir)" />-->
  <Message Text="=== Publish PVP ... done ===============================================" />
</Target>

In any case we support only .DLL and .EXE modules. Just consider using our Pre/Post-processing if you need some actions/packing/etc:

To all,

Guys! I cannot personally resolve the unknown issues until I receive the minimal info requested earlier. Please also don't fragment information because this could aggregate various unrelated issues between the different stages as you can see above. Also do not distort info as much as possible (please only remove any confidential data).

3F added a commit that referenced this issue Nov 24, 2024
for the cases like ImplicitUsings=true etc.

It will probably help with problems like #184
@3F
Copy link
Owner

3F commented Nov 24, 2024

If I understood (for all that) the problem correctly,

error CS0246: The type or namespace name 'DllExport' could not be found (are you missing a using directive or an assembly reference?

For some cases we need to regenerate missed meta. This can be done manually using the following command:

DllExport -action Restore

If so, 7ee50d0 will fix the current problem. You can check it using related CI build until the new version.

I close the issue. If the fix doesn't help, please open it again or create a new one.

@3F 3F closed this as completed Nov 24, 2024
@3F 3F added this to the 1.8 milestone Dec 4, 2024
3F added a commit that referenced this issue Feb 25, 2025
* NEW: Extends support for .NET 9, .NET 8, .NET 7,
       .NET 6, .NET 5, netcoreapp3.1, netstandard2.1, ...
       Issues: #219, #193, #132, #239

* NEW: Custom `.typref ...` & `.assembly extern ...` in the Wizard
       using modern 3F's IL Assembler 9.3+

* NEW: Support $-interpolation in modern .NET 9-6, Span, Memory, ...
       configure in the Wizard.

* NEW: New [Ref] packages control and related options.

* NEW: ImageBase + step control in multiple targeting.
       configure in the Wizard.

* NEW: New `DllExport -pe` keys:
          -list-addr, -list-ord, -list-all
          -magic, -num-functions, -base

* NEW: Official ILRepack support in Pre-processing; 2.0.39
       https://github.com/gluck/il-repack/releases/tag/2.0.39

* NEW: New PE Check option to control PE32/PE32+ arch.

* NEW: -action RecoverInit in addition to -action Recover;
       Recover to initial setup using predefined/exported data.

* NEW: Option to refresh intermediate module (obj) using modified. Issue #206.

* NEW: x86+x64 copy support for `Publish` targets. Related issue #224.
       `DllExportResolvePublish` property to control it.

* FIXED: Crashes or empty exports if code contains `.class extern forwarder` declarations.

* FIXED: error: syntax error at token '.' in .interfaceimpl type... Issue: #205.

* FIXED: Post-Proc: possible "The given key was not present in the dictionary."

* FIXED: Fixed Pre-Proc ILMerge for netcore.

* FIXED: Fix copying to own directory for "Provide x86+x64 assemblies"
         when no active dependencies.

* FIXED: Pre-Proc: fixed edit Exec raw command in the Wizard.

* FIXED: Fixed possible Incorrect RVA: 0 when PE Check is on.

* FIXED: Fixed -action Export: Parameter "unevaluatedValue" cannot be null.

* FIXED: Fixed Post-Proc DllExportDirX64 & DllExportDirX86 properties.

* FIXED: DllExportResolvePublish support for a single platform
         Related issue #235 or like.

* FIXED: Failed to write to log file ... because it is being used by another process. Issue #223.

* CHANGED: Execute `-action Restore` in case of loss of generated meta
         for the cases like ImplicitUsings=true etc.
         It will probably help with problems like #184.

* CHANGED: Improved support for nested projects using $(DllExportDir) etc.

* CHANGED: Improved managing `PlatformTarget` when applying the configuration.

* CHANGED: Improved TargetFrameworks multi-targeting support. ImageBase can be configured separately.

* CHANGED: Improved IsNetCoreBased logic for modern tfms.

* CHANGED: Improved cleaning logic at Pre-processing stage to delete correctly DllExport.Dll, Conari.dll
           and other assemblies from TargetDir when merging using [Ref] etc.

* CHANGED: `DllExport -action keys` are no longer case sensitive.

* CHANGED: Adds /PDB /OPTIMIZE and other types of PDB generation.
            Automatic option is relied on DebugType + Optimize + DebugSymbols properties:
            * Optimize: Optimize long instructions to short
            * PdbOptimize: +Create the PDB file without enabling debug info tracking
            * DebugOptimize: Enable JIT optimization, create PDB file, use implicit sequence points
            * Debug: Disable JIT optimization, create PDB file, use sequence points from PDB
            * DebugImpl: Disable JIT optimization, create PDB file, use implicit sequence points
            * Legacy True/False: Debug or Optimize

* CHANGED: Updated .PDB deletion logic according to ISymUnmanagedWriter problem.

* CHANGED: Use `wDxpMsgLevel` environment variable to control message level.

* CHANGED: Full integration with modern hMSBuild 2.4.1+
           https://github.com/3F/hMSBuild
           ```
           DllExport -hMSBuild -help
           ```

           GetNuTool now through hMSBuild engine:
           ```
           DllExport -hMSBuild -GetNuTool ...
           ```

* CHANGED: `DllExport -pe-exp-list` marked as obsolete;
           Use new `-pe` instead.
           ```
           DllExport -pe -help
           ```

* CHANGED: +Log option for IlMerge & ILRepack in the Wizard.

* CHANGED: Changed `-action Upgrade` logic same to `-action Configure`

* CHANGED: Make all paths relative as `$(DllExportDir)..\` in configured project files.

* CHANGED: Updated wrapper in offline version
           `offline.DllExport.1.8...zip` https://www.nuget.org/packages/DllExport/1.8

* CHANGED: Added netfx4sdk 1.2 helper to build using legacy tfm
           https://github.com/3F/netfx4sdk

* CHANGED: Updated
           * ILAsm 9.3.0
             https://github.com/3F/coreclr/releases/tag/9.3.0

           * ILMerge 3.0.41
             https://www.nuget.org/packages/ilmerge/3.0.41

           * Cecil 0.11.6
             https://github.com/jbevain/cecil/releases/tag/0.11.6

           * Conari 1.5.0
             https://github.com/3F/Conari/releases/tag/1.5

           * MvsSln 2.7 with enabled Huid implementation
             3F/MvsSln#51 (comment)

* NOTE: Tests for net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;netstandard2.1;netstandard2.0;net472;...
        can be found in official repo https://github.com/3F/DllExport

        ~ https://github.com/3F/DllExport/tree/master/src/DllExport/assets
          https://github.com/3F/DllExport/tree/master/src/DllExport/UnitedTest

* NOTE: To upgrade to 1.8:
        DllExport -mgr-up -dxp-version 1.8
        or
        DllExport -action Upgrade -dxp-version 1.8

* NOTE: official manager can be found here:
        https://3F.github.io/DllExport/releases/latest/manager/
        or here:
        * https://github.com/3F/DllExport/releases/tag/1.8
        * https://www.nuget.org/packages/DllExport/1.8
3F added a commit that referenced this issue Feb 25, 2025
* NEW: Extends support for .NET 9, .NET 8, .NET 7,
       .NET 6, .NET 5, netcoreapp3.1, netstandard2.1, ...
       Issues: #219, #193, #132, #239

* NEW: Custom `.typref ...` & `.assembly extern ...` in the Wizard
       using modern 3F's IL Assembler 9.3+

* NEW: Support $-interpolation in modern .NET 9-6, Span, Memory, ...
       configure in the Wizard.

* NEW: New [Ref] packages control and related options.

* NEW: ImageBase + step control in multiple targeting.
       configure in the Wizard.

* NEW: New `DllExport -pe` keys:
          -list-addr, -list-ord, -list-all
          -magic, -num-functions, -base

* NEW: Official ILRepack support in Pre-processing; 2.0.39
       https://github.com/gluck/il-repack/releases/tag/2.0.39

* NEW: New PE Check option to control PE32/PE32+ arch.

* NEW: -action RecoverInit in addition to -action Recover;
       Recover to initial setup using predefined/exported data.

* NEW: Option to refresh intermediate module (obj) using modified. Issue #206.

* NEW: x86+x64 copy support for `Publish` targets. Related issue #224.
       `DllExportResolvePublish` property to control it.

* FIXED: Crashes or empty exports if code contains `.class extern forwarder` declarations.

* FIXED: error: syntax error at token '.' in .interfaceimpl type... Issue: #205.

* FIXED: Post-Proc: possible "The given key was not present in the dictionary."

* FIXED: Fixed Pre-Proc ILMerge for netcore.

* FIXED: Fix copying to own directory for "Provide x86+x64 assemblies"
         when no active dependencies.

* FIXED: Pre-Proc: fixed edit Exec raw command in the Wizard.

* FIXED: Fixed possible Incorrect RVA: 0 when PE Check is on.

* FIXED: Fixed -action Export: Parameter "unevaluatedValue" cannot be null.

* FIXED: Fixed Post-Proc DllExportDirX64 & DllExportDirX86 properties.

* FIXED: DllExportResolvePublish support for a single platform
         Related issue #235 or like.

* FIXED: Failed to write to log file ... because it is being used by another process. Issue #223.

* CHANGED: Execute `-action Restore` in case of loss of generated meta
         for the cases like ImplicitUsings=true etc.
         It will probably help with problems like #184.

* CHANGED: Improved support for nested projects using $(DllExportDir) etc.

* CHANGED: Improved managing `PlatformTarget` when applying the configuration.

* CHANGED: Improved TargetFrameworks multi-targeting support. ImageBase can be configured separately.

* CHANGED: Improved IsNetCoreBased logic for modern tfms.

* CHANGED: Improved cleaning logic at Pre-processing stage to delete correctly DllExport.Dll, Conari.dll
           and other assemblies from TargetDir when merging using [Ref] etc.

* CHANGED: `DllExport -action keys` are no longer case sensitive.

* CHANGED: Adds /PDB /OPTIMIZE and other types of PDB generation.
            Automatic option is relied on DebugType + Optimize + DebugSymbols properties:
            * Optimize: Optimize long instructions to short
            * PdbOptimize: +Create the PDB file without enabling debug info tracking
            * DebugOptimize: Enable JIT optimization, create PDB file, use implicit sequence points
            * Debug: Disable JIT optimization, create PDB file, use sequence points from PDB
            * DebugImpl: Disable JIT optimization, create PDB file, use implicit sequence points
            * Legacy True/False: Debug or Optimize

* CHANGED: Updated .PDB deletion logic according to ISymUnmanagedWriter problem.

* CHANGED: Use `wDxpMsgLevel` environment variable to control message level.

* CHANGED: Full integration with modern hMSBuild 2.4.1+
           https://github.com/3F/hMSBuild
           ```
           DllExport -hMSBuild -help
           ```

           GetNuTool now through hMSBuild engine:
           ```
           DllExport -hMSBuild -GetNuTool ...
           ```

* CHANGED: `DllExport -pe-exp-list` marked as obsolete;
           Use new `-pe` instead.
           ```
           DllExport -pe -help
           ```

* CHANGED: +Log option for IlMerge & ILRepack in the Wizard.

* CHANGED: Changed `-action Upgrade` logic same to `-action Configure`

* CHANGED: Make all paths relative as `$(DllExportDir)..\` in configured project files.

* CHANGED: Updated wrapper in offline version
           `offline.DllExport.1.8...zip` https://www.nuget.org/packages/DllExport/1.8

* CHANGED: Added netfx4sdk 1.2 helper to build using legacy tfm
           https://github.com/3F/netfx4sdk

* CHANGED: Updated
           * ILAsm 9.3.0
             https://github.com/3F/coreclr/releases/tag/9.3.0

           * ILMerge 3.0.41
             https://www.nuget.org/packages/ilmerge/3.0.41

           * Cecil 0.11.6
             https://github.com/jbevain/cecil/releases/tag/0.11.6

           * Conari 1.5.0
             https://github.com/3F/Conari/releases/tag/1.5

           * MvsSln 2.7 with enabled Huid implementation
             3F/MvsSln#51 (comment)

* NOTE: Tests for net9.0;net8.0;net7.0;net6.0;net5.0;netcoreapp3.1;netstandard2.1;netstandard2.0;net472;...
        can be found in official repo https://github.com/3F/DllExport

        ~ https://github.com/3F/DllExport/tree/master/src/DllExport/assets
          https://github.com/3F/DllExport/tree/master/src/DllExport/UnitedTest

* NOTE: To upgrade to 1.8:
        DllExport -mgr-up -dxp-version 1.8
        or
        DllExport -action Upgrade -dxp-version 1.8

* NOTE: official manager can be found here:
        https://3F.github.io/DllExport/releases/latest/manager/
        or here:
        * https://github.com/3F/DllExport/releases/tag/1.8
        * https://www.nuget.org/packages/DllExport/1.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants