在 Visual Studio 2010 上发布网站失败 (MVC3)
我正在尝试使用 Visual Studio 2010 中解决方案资源管理器的属性中提供的发布选项来发布网站,但出现错误,以下是错误:
错误 1 正在复制文件 obj\Release\Package\PackageTmp\Content\css\Site .css 到 obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\Content\css\Site.css 失败。找不到文件 'obj\Release\Package\PackageTmp\Content\css\Site.css'
任何想法或建议,为什么弹出此错误导致发布失败。我还检查了 obj\Release 文件夹,几乎所有文件旁边都有一个感叹号。
I am trying to publish the website using Publish option provided in the properties of the solution Explorer in Visual Studio 2010 but I am getting errors , below is the error:
Error 1 Copying file obj\Release\Package\PackageTmp\Content\css\Site.css to obj\Release\Package\PackageTmp\obj\Release\Package\PackageTmp\Content\css\Site.css failed. Could not find file 'obj\Release\Package\PackageTmp\Content\css\Site.css'
Any ideas or suggestion , why this error is popping up causing publishing to fail. Also I check my obj\Release folder , almost all the files have got an exclaimation mark next to it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
进入 Windows 资源管理器,导航到网站的根目录,找到
bin
和obj
文件夹并将它们发送到回收站。构建应用程序并尝试再次发布。编辑
这是因为您的项目中存在一个不存在的文件引用,或者该文件引用的版本与您的项目文件所需的版本不同。尝试在解决方案资源管理器中单击
显示所有文件
,然后找到旁边带有黄色三角形的文件。然后右键->从项目中排除。那应该可以解决你的问题。Go into windows explorer, navigate to the root of your website, locate the
bin
andobj
folders and send them to the recycle bin. Build the app and try to publish again.EDIT
It's because you have a file reference in your project that doesn't exist or is a different version to what your project file expects. Try clicking the
Show All Files
in the solution explorer and finding the file with the yellow triangle next to it. Then right click -> Exclude from project. That should solve your problem.我猜你直接删除一些项目文件(不是从项目中删除)
项目仍然引用它们并在发布
关闭解决方案并再次打开它然后从项目中删除文件时查找它们
I guess you delete some project file directly(not from project)
Project still have reference to them and looking for them while publishing
Close Solution and Open it Again then delete file from Project
意识到这个问题已经得到回答,但我想我会做出贡献。
收到同样的错误。该文件在 Visual Studio 中显示。
最终我试图打开它,但打不开。
事实证明,其他开发人员之一已排除该文件,然后提交给源代码管理(TFS)。然后我得到了最新的。
尽管构建成功,但我随后的发布失败了(这是一个 cshtml 文件,因此这是可以预料的)。
我也从我的项目中排除了该文件,并且一切正常。
希望这对其他人有帮助,我很惭愧地说我为此失去了一个小时......
Realise this has been answered but thought I would contribute.
Received the same error. The file was showing as there in Visual Studio.
Eventually I tried to open it and couldn't.
Turns out one of the other devs had excluded the file and then committed to source control (TFS). I then got the latest.
My subsequent publish failed, although build succeeded (it was a cshtml file so this was to be expected).
I excluded the file from my project also and all worked.
Hope this helps someone else out, I'm ashamed to say I lost an hour of my life to this...
它正在寻找不存在的文件,
如果解决方案中缺少您的诡计,它将不允许构建。
这是解决方案中的问题,认为文件存在,如果您通过 Windows 资源管理器查看文件应该所在的位置,则它不再存在。所以它试图复制不存在的文件..
希望这有帮助
--误读
文件上的右键。
选择选项构建操作并选择内容
复制到输出目录 选择始终复制(这将确保将文件复制到目录中)
发布,文件应该在那里
,您应该准备好开始:)
It is looking for file that does not exists,
if your wile is missing in solution it will not allow to build.
this is problem in solution thinking that file is exists and if you look via windows explorer to location where the file is supossed to be, it is not there anymore. So it is trying to copy nonexisting file ..
Hope this helps
--misread
right button on the file.
select option build action and select content
copy to output directory select copy always (this will ensure coping the file into the directory)
publish and the file should be there
and you should be ready to go:)