问题
I'm working in an ASP.NET Web Site project (as opposed to an Web Application project, meaning it doesn't have a .csproj file).
The solution is structured like this:
-Solution
|-dlls
| |-AjaxControlToolkit.dll
|-packages
| |-Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1
| | |-(...)
| |-RestSharp.106.6.7
| |-(...)
|-WebSiteProject
| |-Bin
| | |-(.refresh files listed below)
| |-packages.config
| |-(other website files)
After a fresh checkout from source control, in the Bin folder I have these:
AjaxControlToolkit.dll.refresh:
..\dlls\AjaxControlToolkit.dllMicrosoft.CodeDom.Providers.DotNetCompilerPlatform.dll.refresh:
..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dllRestSharp.dll.refresh:
..\packages\RestSharp.106.6.9\lib\net452\RestSharp.dllroslyn/csc.exe.refresh:
..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\tools\roslynlatest\csc.exe...and other files in the
roslynfolder ending in.dll.refresh, all similar tocsc.exe.refreshabove.
Upon building the web site, these files appear in the Bin folder:
- ajaxcontroltoolkit.dll
- restsharp.dll
- restsharp.dll.xml
But, Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll does not, and neither do any of the binary files in roslyn/. Thus, the site cannot validate/run.
I have three questions, all closely related:
Is it correct to check-in to source control (TFS) only the files ending in
.refreshand assume the binaries will be copied locally by the build process?How are
ajaxcontroltoolkit.dllandrestsharp.dllcopied correctly (fromSolution/dllsandSolution/packages/RestSharp.105.2.3, respectively), even though the relative paths are wrong?Why is the same magic not working for
Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dlland for all binaries in theroslyndirectory?
Note: because this is a web site project, sure there are no pre- or post-build events.
Thanks.
P.S. the contents of WebSiteProject/packages.config:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.1" targetFramework="net472" />
<package id="RestSharp" version="106.6.9" targetFramework="net472" />
</packages>
回答1:
Here's what I found.
- Is it correct to check-in to source control (TFS) only the files ending in .refresh and assume the binaries will be copied locally by the build process?
It is, not necessarily by the "build process" though (in quotes because there isn't actually a build per se). I found that simply clicking another project in the solution, then clicking the web site project again, will trigger the copy. Or also, clicking the Refresh button in the Solution Explorer's top bar (when the web site project has focus).
But there is a caveat: this only works for files directly in the Bin folder (not for those in Bin/roslyn for example), no matter if the paths are correct (I even tried absolute paths, which works in Bin, but not under Bin/subdir.
- How are
ajaxcontroltoolkit.dllandrestsharp.dllcopied correctly (fromSolution/dllsandSolution/packages/RestSharp.105.2.3, respectively), even though the relative paths are wrong?
After some testing I concluded that the paths are relative from the project directory (what would be $(ProjectPath) in a web application project).
- Why is the same magic not working for
Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dlland for all binaries in theroslyndirectory?
It was in fact working for Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll.refresh. Regarding roslyn/*, see the caveat in question 1.
来源:https://stackoverflow.com/questions/55818553/clarifying-dll-refresh-files-source-control-and-build-of-an-asp-net-web-sit