光放在debug目录是没用的,应该放在cs文件目录,然后加入工程,并且鼠标右键点击References目录,把这些dll添加到引用目录中,才会去掉感叹号,

解决方案 »

  1.   

    按照你的做了, 但是它报错了:弹出一个对话框, 里面的文字如下
    Microsoft visual studio
    A project with an output type of class library cannot be started directly.
    In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.
      

  2.   

    错误提示如下:------ Build started: Project: ATTENUATIONC, Configuration: Debug Any CPU ------
    C:\ATTENUATIONC\schemeselection .cs(194,30): warning CS0168: The variable 'ex' is declared but never usedCompile complete -- 0 errors, 1 warnings
    Build started 2012-5-10 20:54:57.
    CoreResGen:
      c:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\ResGen.exe /useSourcePath /r:C:\ATTENUATIONC\bin\Debug\Excel.dll /r:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /r:C:\ATTENUATIONC\bin\Debug\noiseBaseDataTable.dll /r:C:\ATTENUATIONC\bin\Debug\noiseGraph.dll /r:C:\ATTENUATIONC\bin\Debug\noiseGraphDLL.dll /r:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /r:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /r:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /r:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /r:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /r:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /r:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /r:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /r:C:\ATTENUATIONC\VBIDE.dll /r:C:\ATTENUATIONC\bin\Debug\Word.dll /r:C:\ATTENUATIONC\bin\Debug\WordAuto.dll /r:C:\ATTENUATIONC\WriteToWord2003.dll /r:C:\ATTENUATIONC\WriteToWord2007.dll /compile DengZhiMian.resx,obj\Debug\AttenuationCalculation.DengZhiMian.resources FormCurveForNoiseBarrier.resx,obj\Debug\AttenuationCalculation.FormCurveForNoiseBarrier.resources FormNoiseCurveOnLine.resx,obj\Debug\AttenuationCalculation.FormNoiseCurveOnLine.resources GridSetPlanarSurface.resx,obj\Debug\AttenuationCalculation.GridSetPlanarSurface.resources ManageCorrectValue.resx,obj\Debug\AttenuationCalculation.ManageCorrectValue.resources ManageTransformerNoise.resx,obj\Debug\AttenuationCalculation.ManageTransformerNoise.resources NoiseCalculation.resx,obj\Debug\AttenuationCalculation.NoiseCalculation.resources Properties\Resources.resx,obj\Debug\AttenuationCalculation.Properties.Resources.resources "schemeselection .resx",obj\Debug\AttenuationCalculation.schemeselection.resources singleSourceMeshing.resx,obj\Debug\AttenuationCalculation.singleSourceMeshing.resources ManageBarrier.resx,obj\Debug\AttenuationCalculation.ManageBarrier.resources 
    CoreCompile:
      c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:C:\ATTENUATIONC\bin\Debug\Excel.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\ATTENUATIONC\bin\Debug\noiseBaseDataTable.dll /reference:C:\ATTENUATIONC\bin\Debug\noiseGraph.dll /reference:C:\ATTENUATIONC\bin\Debug\noiseGraphDLL.dll /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:C:\ATTENUATIONC\VBIDE.dll /reference:C:\ATTENUATIONC\bin\Debug\Word.dll /reference:C:\ATTENUATIONC\bin\Debug\WordAuto.dll /reference:C:\ATTENUATIONC\WriteToWord2003.dll /reference:C:\ATTENUATIONC\WriteToWord2007.dll /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\ATTENUATIONC.dll /resource:obj\Debug\AttenuationCalculation.DengZhiMian.resources /resource:obj\Debug\AttenuationCalculation.FormCurveForNoiseBarrier.resources /resource:obj\Debug\AttenuationCalculation.FormNoiseCurveOnLine.resources /resource:obj\Debug\AttenuationCalculation.GridSetPlanarSurface.resources /resource:obj\Debug\AttenuationCalculation.ManageCorrectValue.resources /resource:obj\Debug\AttenuationCalculation.ManageTransformerNoise.resources /resource:obj\Debug\AttenuationCalculation.NoiseCalculation.resources /resource:obj\Debug\AttenuationCalculation.Properties.Resources.resources /resource:obj\Debug\AttenuationCalculation.schemeselection.resources /resource:obj\Debug\AttenuationCalculation.singleSourceMeshing.resources /resource:obj\Debug\AttenuationCalculation.ManageBarrier.resources /target:library AttenuationC.cs DengZhiMian.cs DengZhiMian.Designer.cs ForecastReport.cs FormCurveForNoiseBarrier.cs FormCurveForNoiseBarrier.designer.cs FormNoiseCurveOnLine.cs FormNoiseCurveOnLine.Designer.cs GridData.cs GridSetPlanarSurface.cs GridSetPlanarSurface.Designer.cs ManageCorrectValue.cs ManageCorrectValue.designer.cs ManageTransformerNoise.cs ManageTransformerNoise.designer.cs NoiseCalculation.cs NoiseCalculation.Designer.cs optimize.cs Properties\AssemblyInfo.cs Properties\Resources.Designer.cs PublicFunction.cs "schemeselection .cs" "schemeselection .Designer.cs" singleSourceMeshing.cs singleSourceMeshing.Designer.cs writeDatatoForecastReport.cs writeDatatoSurface.cs ManageBarrier.cs ManageBarrier.designer.cs
    _CopyFilesMarkedCopyLocal:
      Copying file from "C:\ATTENUATIONC\VBIDE.dll" to "bin\Debug\VBIDE.dll".
    CopyFilesToOutputDirectory:
      Copying file from "obj\Debug\ATTENUATIONC.dll" to "bin\Debug\ATTENUATIONC.dll".
      ATTENUATIONC -> C:\ATTENUATIONC\bin\Debug\ATTENUATIONC.dll
      Copying file from "obj\Debug\ATTENUATIONC.pdb" to "bin\Debug\ATTENUATIONC.pdb".Build succeeded.Time Elapsed 00:00:05.81
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========此外还有一个弹出的错误提示框
    标题:Microsoft Visual Studio
    内容:A project with an Output Type of Class Library cannot be started directly .
    In order to debug this project, add an executable project to this solution which references the library project. Set the executable project as the startup project.
    可是 从上面明明看出编译是成功的, 为什么run时 出现这样的问题? 怎么修改呢?
      

  3.   

    不能直接启动类库的,至少要有一个form或者其他的程序来调用这个类库。
    如果你一定要用直接运行这个类库,只能用 "调试--启用新实例"。