I'm having problems when publishing a .NET Core MVC project. I've tried with Visual Studios built-in publishing (right-click project -> Publish) but that doesn't seem to work. The same goes for using dotnet publish.
Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.1
Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1
Runtime Environment:
OS Name: debian
OS Version: 8
OS Platform: Linux
RID: debian.8-x64
Base Path: /opt/dotnet/sdk/1.0.1
dotnet run produces the following error:
Couldn't find a project to run. Ensure a project exists in /my/path/to/my/project. Or pass the path to the project using --project
dotnet restore produces the following error:
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
The project was originally made using VS 2015, but recently upgraded to use the new VS 2017. I suppose this could have something to do with the new structure and json config, that is no longer used?
If you need further information please let me know.
Can you share your csproj? Also, in the folder that you are running restore and run, do you have a csproj there? dotnet restore will no longer restore all projects in a folder. It will restore a sln (and all projects in the SLN) or a project (and that project's dependencies).
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<DebugType>portable</DebugType>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>OurGhostsOfWar</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>OurGhostsOfWar</PackageId>
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<None Update="bin\**\*;wwwroot\**\*;Views\**\*;Areas\**\Views">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="MailKit" Version="1.10.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Session" Version="1.0.2" />
<PackageReference Include="Sakura.AspNetCore.PagedList" Version="2.0.1" />
<PackageReference Include="Sakura.AspNetCore.Mvc.PagedList" Version="2.0.11" />
<PackageReference Include="jQuery.mvc.LightBox" Version="1.0.2" />
<PackageReference Include="HtmlAgilityPack" Version="1.4.9.5" />
<PackageReference Include="MySql.Data" Version="7.0.6-IR31" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="1.1.1-prerelease-10017" />
</ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="bower install" />
<Exec Command="dotnet bundle" />
</Target>
<ItemGroup>
<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Resources\Emails.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Emails.resx</DependentUpon>
</Compile>
<Compile Update="Resources\Error.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Error.resx</DependentUpon>
</Compile>
<Compile Update="Resources\General.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>General.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Emails.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Emails.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\Error.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Error.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Resources\General.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>General.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
There is no project nor solution file in my published folder
If I create a completely new .NET Core MVC application, and publish said project, the same things happens. No project/solution file present in the working directory.
if you run dotnet --info, what is the output?
I have already provided the info for two different environments giving the same error. One for my local windows machine, and one for a debian environment
I wanted to make sure of how you obtained that information.
Can you try running dotnet restore path/to/csproj and likewise for the other commands?
Would you like me to just test this on my local machine since the project
file doesn't exist in the production environment (debian)
I guess I could just run dot net restore in my local publish folder and
point to the project file in my development folders?
man. 13. mar. 2017 kl. 22.27 skrev Livar notifications@github.com:
I wanted to make sure of how you obtained that information.
Can you try running dotnet restore path/to/csproj and likewise for the
other commands?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/dotnet/core/issues/552#issuecomment-286249302, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AG5vxva4iB_y9eBJRtcwxuB1A-A56jNpks5rlbTTgaJpZM4MbzzU
.>
Best Regards,
Christian Haase
Torvegade 13 2. sal
6700 Esbjerg
Phone: (+45) 61 13 19 37
E-mail: Christian.haase.[email protected] Christian.haase.93@gmail.com
Skype: christian.haase.93
*Skype calling hours:
Mon-Fri: 16:15 - 17:30 & 19:30 - 22:30 (4:15pm - 5:30pm & 7:30pm -
10:30pm)
*Sat-Sun: 10:00 - 17:30 & 19:30 - 21:00 (10:00am - 5:30pm & 7:30pm - 9:00pm
) *
*All times are in GMT+1 (Copenhagen)
We must be talking past each other. What do you mean the project file does not exist in the production environment?
restore/build/run/publish all need a csproj file.
If what you are doing is publishing a project from one machine and then copying the published content to another machine and trying to run it, then you don't need to restore and you can't use dotnet run to execute it.
You need one of two things:
Does this help a bit?
Okay that makes sense. Would do you mean by shared framework though?
tir. 14. mar. 2017 kl. 06.03 skrev Livar notifications@github.com:
We must be talking past each other. What do you mean the project file does
not exist in the production environment?restore/build/run/publish all need a csproj file.
If what you are doing is publishing a project from one machine and then
copying the published content to another machine and trying to run it, then
you don't need to restore and you can't use dotnet run to execute it.You need one of two things:
- If the app is a portable application, you need to have at least the
shared framework for which the app was published installed in the machine
where you want to run it. And you execute it by running dotnet
. Just be sure that dotnet with the shared
framework is in your path or when invoking dotnet give it its full path.- If the app is a self-contained app, then, just run your app.exe
directly from the published folder.Does this help a bit?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/dotnet/core/issues/552#issuecomment-286323000, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AG5vxgnsGZ8t2Y9-4lnyLI3bAUSu7ieWks5rlh-KgaJpZM4MbzzU
.>
Best Regards,
Christian Haase
Torvegade 13 2. sal
6700 Esbjerg
Phone: (+45) 61 13 19 37
E-mail: Christian.haase.[email protected] Christian.haase.93@gmail.com
Skype: christian.haase.93
*Skype calling hours:
Mon-Fri: 16:15 - 17:30 & 19:30 - 22:30 (4:15pm - 5:30pm & 7:30pm -
10:30pm)
*Sat-Sun: 10:00 - 17:30 & 19:30 - 21:00 (10:00am - 5:30pm & 7:30pm - 9:00pm
) *
*All times are in GMT+1 (Copenhagen)
The shared framework is the .NET runtime for .NET Core.
The SDK contains a set of tools (the CLI) which allows restore/build/run/publish amongst other things and it also conveniently ships with the shared framework(s).
If all you care about is running a portable application, then you don't need the SDK and you only need the runtime. The link I sent you above has pointers to both.
Sorry, I don't see any links?
How come this has changed? With VS 2015 and .NET Core 1.0.0, I could publish, transfer the files to my production environment, and run the command dotnet run. This would run the project on my debian machine, and everything would work fine. I'm not sure about how I run the project with the new structure and the new publish flow?
I think my problem is that I don't know how to publish an run the project. Perhaps you could guide me? By publishing the project I only get a dll file of my project so I suppose this is a portable publish. So I need to install .NET core runtime on my Debian server correct? Then how do I run the project as I did before with dotnet run?
You can run dotnet <path_to_your_published_app_dll>.
When you install the shared framework, it will bring with it the host (dotnet).
Oh wow. I didn't really catch the fact that it's not dotnet run <path_to_my_published_app_dll> but that it's just dotnet <path_to_my_published_app_dll>. It looks like it's wroking now, except for some MySQL error.
Thank for your assistance. Hope I didn't take to much of your time 👍
No worries. Happy it is working now and sorted out.
Most helpful comment
Oh wow. I didn't really catch the fact that it's not
dotnet run <path_to_my_published_app_dll>but that it's justdotnet <path_to_my_published_app_dll>. It looks like it's wroking now, except for some MySQL error.Thank for your assistance. Hope I didn't take to much of your time 👍