1

I have the line using System.Deployment.Application; at the beginning of my code. There is a red squiggly line under Application and mousing over it gives me the following information:

The type or namespace name 'Application' does not exist in the namespace 'System.Deployment' (are you missing an assembly reference?) (CS0234)

This of course gives me problems when I use ApplicationDeployment and it says The name 'ApplicationDeployment' does not exist in the current context (CS0103)

Why is Visual Studio telling me that Application is not a part of System.Deployment?

katiedidkatie
  • 157
  • 10
  • 5
    do you have a reference to an assembly that has that namespace in it? – Daniel A. White Jul 24 '19 at 18:00
  • @DanielA.White I don't believe so... this is the only file in the project that references System.Deployment.Application – katiedidkatie Jul 24 '19 at 18:02
  • @DanielA.White I just trying running the line ```dotnet add package System.Deployment.dll``` and the terminal says the project does not support adding package references through the add package command – katiedidkatie Jul 24 '19 at 18:25

1 Answers1

1

From Visual Studio Code, open your.csproj file. In this file you can add an assembly reference to System.Deployment which should fix you issue.

Reference:

    <Reference Include="System.Deployment"/>

This will be added in the ItemGroup Section of the .csproj file

<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="System.Deployment"/>
</ItemGroup>
Brad
  • 66
  • 6
  • Where can I find the Solution Explorer? – katiedidkatie Jul 24 '19 at 18:08
  • If it helps, I have VS Code verision 1.35.1 – katiedidkatie Jul 24 '19 at 18:10
  • 1
    @katiedidkatie: Despite the confusing name, "Visual Studio" and "Visual Studio Code" are entirely different applications. I suspect you want to find a VS Code tag for your post. – Jon Skeet Jul 24 '19 at 18:11
  • 1
    read this : https://stackoverflow.com/questions/31888274/how-to-reference-assemblies-using-visual-studio-code – Ali Maleki Jul 24 '19 at 18:13
  • 1
    @katiedidkatie Like Jon mentioned, Visual Studio and Visual Studio Code are two very different beasts. I was assuming that you were not using Visual Studio Code. This may help you : https://stackoverflow.com/questions/42000798/how-to-add-assembly-references-in-visual-studio-code/42399545 – Brad Jul 24 '19 at 18:16