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

How can I add an COM reference into a c# proj in vscode #2338

Closed
shikouzhong opened this issue May 23, 2018 · 3 comments
Closed

How can I add an COM reference into a c# proj in vscode #2338

shikouzhong opened this issue May 23, 2018 · 3 comments

Comments

@shikouzhong
Copy link

Yes, we can add a nuget package using the dotnet comand line, but I don't know how to add a COM reference in vscode, just as in vs community and is it supported in omnisharp-vscode?

I have searched the stackoverflow, but no right answer for c# proj in vscode.

-VSCode Version: 1.23.0
-OS Version: Windows 10 1803

@DustinCampbell
Copy link
Member

It sounds like this is really a .NET project question rather than C# for VS Code. Assuming that your project targets .NET Framework, I would expect a legal <ComReference /> in your project to just work on Windows, but I'm unsure of the level of support for them in the .NET Core SDK. If they're supported, there's certainly not a gesture to add them to the project today.

cc @livarcocc, @dsplaisted, and @nguerrera from the .NET Core SDK team.

@ghost
Copy link

ghost commented May 12, 2020

A lot of time has passed since this was posted, but the issue basically boils down to this msbuild issue. The dotnet CLI doesn't support it. I'm currently investigating a workaround using MSBuild for VS 2019 without the IDE. I finally got it to work with the following in my tasks.json file, using msbuild instead of dotnet

    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "msbuild",
            "args": [
                "/property:GenerateFullPaths=true",
                "/t:build",
                "/consoleloggerparameters:NoSummary"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "reveal": "silent"
            },
            "problemMatcher": "$msCompile"
        }
    ]

And in the csproj file, in my case, I needed to force the platform target to x86

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>

@JoeRobich
Copy link
Member

Closing as answered.

@JoeRobich JoeRobich closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
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

4 participants