Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Up until two days ago, I was able to use Visual Studio 2010's "Publish Web" option by right clicking on my project and clicking the publish button on the context menu. Now when I try to do the same thing, I get the following output:

------ Build started: Project: ELMS, Configuration: Debug Any CPU ------
Build started 8/1/2011 3:08:03 PM.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are
up-to-date with respect to the input files.
_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
Copying file from "C:SVNTrakNetrunkMTSlibNewtonsoft.Json.Net35.dll" to 
  "binlibNewtonsoft.Json.Net35.dll".
CopyFilesToOutputDirectory:
  LMS -> C:SVNTrakNetrunkMTSinLMS.dll

Build succeeded.

Time Elapsed 00:00:00.04
------ Publish started: Project: LMS, Configuration: Debug Any CPU ------
Object reference not set to an instance of an object.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

This is while attempting to publish to localhost (for debugging purposes)

Here are the settings of the publish profile that I'm using:

Publish Method: Web Deploy
Service URL: localhost
Site/application: default web site/ELMS
[x] Mark as IIS application on destination
[x] Leave extra files on destination (do not delete)

I have already attempted:

- Cleaning/rebuilding the project
- Deleting the bin folder of the project
- Running reg_iis.exe -i
- Reinstalling VS2010

but nothing I've changed has fixed the error.

Any insight into what might be causing the issue would be greatly appreciated :)

EDIT:

The problem actually resolved itself as of my last reboot. I must have rebooted 6-7 times since the problem first manifested itself, but this time no Object Reference message. Here's the log from the build/publish now:

------ Build started: Project: LMS, Configuration: Debug Any CPU ------
Build started 8/3/2011 9:10:12 AM.
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
  Copying file from "C:SVNTrakNetrunkMTSlibNewtonsoft.Json.Net35.dll" to "binlibNewtonsoft.Json.Net35.dll".
CopyFilesToOutputDirectory:
  LMS -> C:SVNTrakNetrunkMTSinLMS.dll

Build succeeded.

Time Elapsed 00:00:00.04
------ Publish started: Project: LMS, Configuration: Debug Any CPU ------
Gather all files from Project items @(IntermediateAssembly). Adding:
binLMS.dll to binLMS.dll
binLMS.pdb to binLMS.pdb
Gather all files from Project items @(Content). Adding:
Global.asax;libNewtonsoft.Json.Net35.dll;MtsSchemasMtsSchema.xml;Web.config
Gather all files from Project output (IntermediateSatelliteAssembliesWithTargetPath).
Adding:
Gather all files from Project items
@(ReferenceCopyLocalPaths,ReferenceComWrappersToCopyLocal,ResolvedIsolatedComModules,_DeploymentLooseManifestFile,NativeReferenceFile).
Gather all files from Project items @(AllExtraReferenceFiles). Adding:
Gather all files from Project items
@(_SourceItemsToCopyToOutputDirectoryAlways,_SourceItemsToCopyToOutputDirectory). Adding:
binlibNewtonsoft.Json.Net35.dll
Gather all files from Project items @(_binDeployableAssemblies). Adding:
Publish Pipeline Collect Files Phase
Found The following for Config tranformation:
Web.config
Creating directory "C:SVNTrakNetrunkMTSobjDebugTransformWebConfigransformed".
Publish Pipeline Transform Phase
Creating directory "C:SVNTrakNetrunkMTSobjDebugCSAutoParameterizeransformed".
Copying Web.config to objDebugCSAutoParameterizeoriginalWeb.config.
Transforming Source File: C:SVNTrakNetrunkMTSWeb.config
  Applying Transform File: <?xml version="1.0"?>
        <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
          <connectionStrings>
            <add
              connectionString="{% token='$(ReplacableToken_#(parameter)_#(tokennumber))' xpathlocator='name' parameter='$(name)-Web.config Connection String' description='$(name) Connection String used in web.config by the application to access the database.' defaultValue='$(connectionString)' tags='SqlConnectionString' %}"
              xdt:Transform="SetTokenizedAttributes(connectionString)" xdt:SupressWarnings="True" />
          </connectionStrings>
        </configuration>
      Output File: objDebugCSAutoParameterizeransformedWeb.config
    Transformation succeeded
Auto ConnectionString Transformed Web.config into objDebugCSAutoParameterizeransformedWeb.config.
Creating directory "objDebugPackagePackageTmp".
Copying all files to temporary location below for package/publish:
objDebugPackagePackageTmp.
Copying binLMS.dll to objDebugPackagePackageTmpinLMS.dll.
Copying binLMS.pdb to objDebugPackagePackageTmpinLMS.pdb.
Copying Global.asax to objDebugPackagePackageTmpGlobal.asax.
Copying libNewtonsoft.Json.Net35.dll to objDebugPackagePackageTmplibNewtonsoft.Json.Net35.dll.
Copying MtsSchemasMtsSchema.xml to objDebugPackagePackageTmpMtsSchemasMtsSchema.xml.
Copying C:SVNTrakNetrunkMTSlibNewtonsoft.Json.Net35.dll to objDebugPackagePackageTmpinlibNewtonsoft.Json.Net35.dll.
Copying objDebugCSAutoParameterizeransformedWeb.config to objDebugPackagePackageTmpWeb.config.
Publish Pipeline Deploy phase Pre-Deploy CopyAllFilesToOneFolder Stage
Generate source manifest file for Web Deploy package/publish ...
Creating directory "objDebugDatabase".
Starting Web deployment task from source:manifest(C:SVNTrakNetrunkMTSobjDebugPackageLMS.SourceManifest.xml) to Destination:auto().
Updating filePath (default web site/LMSinELMS.dll).
Updating filePath (default web site/LMSinELMS.pdb).
Updating filePath (default web site/LMSinlibNewtonsoft.Json.Net35.dll).
Updating filePath (default web site/LMSlibNewtonsoft.Json.Net35.dll).
Updating filePath (default web site/LMSWeb.config).
Updating setAcl (default web site/LMS).
Updating setAcl (default web site/LMS).
Successfully executed Web deployment task.
Publish is successfully deployed.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

Like I said: No idea what changed. I had been manually moving the DLLs into the website's virtual directory, then just for kicks I tried publishing this morning, and everything worked out fine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
469 views
Welcome To Ask or Share your Answers For Others

1 Answer

In my experience this can happen when files are added/removed from different branches of your source control and an imperfect merge causes the project file structure and the actual file structure to diverge.

This could be one of several options:

  • A file was deleted but the project still references it. Will fail to compile, will fail to publish.
  • A file was added but is not referenced by the project. May compile, depends whether the class/methods are referenced elsewhere in the project/solution. If compiles, will publish.
  • A file was added, but the project merge caused it to appear more than once in the project listing. Will compile, will fail to publish.

The solution is to look at the source control logs and trying to identify the bad merge to the project file for the above issues, then fixing the project file accordingly.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...